Chinmaya Dash
What are the different types of results in MVC?
By Chinmaya Dash in HTML 5 on Feb 05 2016
  • Chinmaya Dash
    Feb, 2016 5

    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

    • 7
  • Ramesh S
    Nov, 2016 29

    ViewResult PartialViewResult RedirectResult RedirectToRouteResult ContentResult JsonResult JavaScriptResult FileResult EmptyResult

    • 2
  • Prakhar Agarwal
    Jun, 2016 29

    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.

    • 2
  • Bhuvanesh Mohankumar
    May, 2016 20

    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/

    • 2
  • Vivek Kumar
    Apr, 2016 17

    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

    • 2
  • Anil Satapathy
    Feb, 2017 27

    Please see nice link here: http://www.c-sharpcorner.com/UploadFile/dacca2/various-return-types-from-mvc-controller/

    • 1
  • Mohammed Deeb Hammoudeh
    Dec, 2016 15

    1- ViewResult.2- PartialViewResult . 3 -RedirectResult.4 -RedirectToRouteResult .5 - ContentResult .6 - JsonResult.7- JsonResult.8- JavaScriptResult.9- FileResult.10 - EmptyResult.

    • 1
  • Mohini Shinde
    Dec, 2016 13

    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

    • 1
  • Mohini Shinde
    Dec, 2016 13

    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

    • 1
  • Mohini Shinde
    Dec, 2016 13

    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

    • 1
  • Mohini Shinde
    Dec, 2016 13

    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

    • 1
  • Mohini Shinde
    Dec, 2016 13

    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

    • 1
  • Aleena Saviour
    Nov, 2016 2

    https://msdn.microsoft.com/en-us/library/system.web.mvc.actionresult(v=vs.118).aspx

    • 1
  • Thennarasu N
    Oct, 2016 22

    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

    • 1
  • Thennarasu N
    Oct, 2016 22

    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

    • 1
  • Umesh Maurya
    Sep, 2016 4

    ViewResult partialViewResult ContentResult EmptyResult FileResult JavaScriptResult JsonResult RedirectResult RedirectToRouteResult

    • 1
  • Vinay Singh
    Aug, 2016 10

    the different type of results in mvc are ViewResult, PartialViewResult, RedirectResult, RedirectToRouteResult, ContentResult, JsonResult, JavaScriptResult, FileResult, EmptyResult

    • 1
  • Soumalya Das
    Aug, 2016 7

    1) ViewResult 2) PartialViewResult 3) RedirectResult 4) RedirectToRouteResult 5) JsonResult 6) JavaScriptResult

    • 1
  • Bikesh Srivastava
    Aug, 2016 4

    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

    • 1
  • Ritesh Singh
    Jul, 2016 26

    Please see nice link here:http://www.c-sharpcorner.com/UploadFile/dacca2/various-return-types-from-mvc-controller/

    • 1
  • Prakhar Agarwal
    Jun, 2016 29

    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.

    • 1
  • Keerthi Venkatesan
    Jun, 2016 8

    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
  • Santosh Kumar Adidawarpu
    May, 2016 9

    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

    • 1
  • Rahul Chavan
    Apr, 2016 6

    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

    • 1
  • Pankaj  Kumar Choudhary
    Feb, 2016 9

    Refer this url for answer http://www.dotnetfunda.com/articles/show/2236/action-results-in-the-controllers-mvc4

    • 1
  • Munesh Sharma
    Feb, 2016 9

    http://dotnet-munesh.blogspot.in/2016/02/what-are-different-types-of-results-in.html

    • 1
  • Hemlata
    Jun, 2017 18

    https://www.exceptionnotfound.net/asp-net-mvc-demystified-actionresults/

    • 0
  • Hemlata
    Jun, 2017 18

    https://www.exceptionnotfound.net/asp-net-mvc-demystified-actionresults/

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS