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 - Serializes 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 9. FileContentResult - Returns a file to the client 10. FileStreamResult - Returns a file to the client, which is provided by a Stream 11. FilePathResult - Returns a file to the client
ViewResult PartialViewResult RedirectResult RedirectToRouteResult ContentResult JsonResult JavaScriptResult FileResult EmptyResult
The ActionResult is the base class for all the return types . it may be either return viewresult , return javascriptresult or else . there are 13 types of results , including return file , return file result , return partial view , return content , return content result etc.
There are multiple results in MVC,Action Result is base for all result.System.Object System.Web.Mvc.ActionResultSystem.Web.Mvc.ContentResult System.Web.Mvc.EmptyResult System.Web.Mvc.FileResult System.Web.Mvc.HttpStatusCodeResult System.Web.Mvc.JavaScriptResult System.Web.Mvc.JsonResult System.Web.Mvc.RedirectResult System.Web.Mvc.RedirectToRouteResult System.Web.Mvc.ViewResultBaseReference http://www.c-sharpcorner.com/UploadFile/dacca2/various-return-types-from-mvc-controller/
1) ViewResult 2) PartialViewResult 3) RedirectResult 4) RedirectToRouteResult 5) ContentResult 6) JsonResult 7) JavaScriptResult 8) HttpStatusCodeResult 9) HttpUnauthorizedResult 10) HttpNotFoundResult 11) FileResult 12) FileContentResult 13) FilePathResult 14) FileStreamResult 15) EmptyResult
Please see nice link here: http://www.c-sharpcorner.com/UploadFile/dacca2/various-return-types-from-mvc-controller/
1- ViewResult.2- PartialViewResult . 3 -RedirectResult.4 -RedirectToRouteResult .5 - ContentResult .6 - JsonResult.7- JsonResult.8- JavaScriptResult.9- FileResult.10 - EmptyResult.
ViewResult =>ViewResult Renders a view as a web page. PartialViewResult =>As the name describe PartialViewResult=> renders the partial view. RedirectResult =>When you want to redirect to another action method we will use RedirectResult RedirectToRouteResult =>Redirect to another action method ContentResult =>Returns a user-defined content type JsonResult =>When you want to return a serialized JSON object JavaScriptResult=>Returns a script that can be executed on the client FileResult=>Returns a binary output to write to the response EmptyResult
ViewResult =>Renders a view as a web page. PartialViewResult =>As the name describe PartialViewResult=> renders the partial view. RedirectResult =>When you want to redirect to another action method we will use RedirectResult RedirectToRouteResult =>Redirect to another action method ContentResult =>Returns a user-defined content type JsonResult =>When you want to return a serialized JSON object JavaScriptResult=>Returns a script that can be executed on the client FileResult=>Returns a binary output to write to the response EmptyResult
https://msdn.microsoft.com/en-us/library/system.web.mvc.actionresult(v=vs.118).aspx
ActionResult Helper Method Description ViewResult View ViewResult Renders a view as a web page. PartialViewResult PartialView As the name describe PartialViewResult renders the partial view. RedirectResult Redirect When you want to redirect to another action method we will use RedirectResult RedirectToRouteResult RedirectToRoute Redirect to another action method ContentResult Content Returns a user-defined content type JsonResult Json When you want to return a serialized JSON object JavaScriptResult JavaScript Returns a script that can be executed on the client FileResult File Returns a binary output to write to the response EmptyResult (None) returns a null result
explained with an example and attached sample code, how to upload files to database in asp.net using FileUpload control and then download saved or stored files from SQL Server database using GridView control
ViewResult partialViewResult ContentResult EmptyResult FileResult JavaScriptResult JsonResult RedirectResult RedirectToRouteResult
the different type of results in mvc are ViewResult, PartialViewResult, RedirectResult, RedirectToRouteResult, ContentResult, JsonResult, JavaScriptResult, FileResult, EmptyResult
1) ViewResult 2) PartialViewResult 3) RedirectResult 4) RedirectToRouteResult 5) JsonResult 6) JavaScriptResult
System.Object System.Web.Mvc.ActionResultSystem.Web.Mvc.ContentResult System.Web.Mvc.EmptyResult System.Web.Mvc.FileResult System.Web.Mvc.HttpStatusCodeResult System.Web.Mvc.JavaScriptResult System.Web.Mvc.JsonResult System.Web.Mvc.RedirectResult System.Web.Mvc.RedirectToRouteResult System.Web.Mvc.ViewResultBase
Please see nice link here:http://www.c-sharpcorner.com/UploadFile/dacca2/various-return-types-from-mvc-controller/
System.Web.Mvc.ActionResultSystem.Web.Mvc.ContentResult System.Web.Mvc.EmptyResult System.Web.Mvc.FileResult System.Web.Mvc.HttpStatusCodeResult System.Web.Mvc.JavaScriptResult System.Web.Mvc.JsonResult System.Web.Mvc.RedirectResult System.Web.Mvc.RedirectToRouteResult System.Web.Mvc.ViewResultBase
1. ContentResult 2. EmptyResult 3. FileResult 4. StatusCodeResult 5. JavaScriptResult 6. JsonResult 7. RedirectResult 8. RedirectToRouteResult 9. ViewResultBase 10. ViewResult 11. PartialViewResult 12. HttpStatusCodeResult 13. HttpUnauthorizedResult 14. HttpNotFoundResult 15. FilePathResult 16. FileStreamResult
Action method returns the Results ActionResult. User response is encapsulated in ActionResult. ActionResult class is the base class for all action results. Types of Results:ContentResultEmptyResultFileResultHttpStatusCodeResultJavaScriptResultJsonResultRedirectResultRedirectToRouteResultViewResultBaseOut these results most widely used result types are: ContentResult JsonResult FileResult ActionResultRefernce: https://msdn.microsoft.com/en-us/library/system.web.mvc.actionresult(v=vs.118).aspx
Refer this url for answer http://www.dotnetfunda.com/articles/show/2236/action-results-in-the-controllers-mvc4
http://dotnet-munesh.blogspot.in/2016/02/what-are-different-types-of-results-in.html
https://www.exceptionnotfound.net/asp-net-mvc-demystified-actionresults/