Powered by Blogger.

Saturday, March 1, 2014

What are different types of results in MVC?



In this post we will discuss about various results in MVC. Also you can check out my previous posts on:

- Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive

- Unable to start debugging on the web server error in Asp.Net

-How to implement FileUpload Control in Update Panel using asp.net?

There are so many types of results in MVC. These are given below:

1. ViewResult->Renders a specified View to the response stream.

2. PartialViewResult->Renders a specified partial view to the response stream.

3. EmptyResult->An empty response is returned.

4. RedirectResult->Performs an HTTP redirection to a specified URL.

5. RedirectToRouteResult->Performs an HTTP redirection to a URL that is determined by the routing engine based on given route data.

6. JSONResult->Serialises a given Viewdata object to JSON format.

7. JavaScriptResult->Returns a piece of Javascript code that can be executed on the client.

8. ContentResult->Writes Content to the response stream without requiring a view.The content result lets you define whatever content you wish to return.

9. FileContentResult->Returns a file from a bytearray to the client.

10. FileStreamResult->Returns a file from a stream to the client.

11. FilePathResult->Returns a file from the server's physical location to the client.





0 comments

Post a Comment