Difference Between ActionResult() and ViewResult() in MVC are-
Sr.No
|
ActionResult()
|
ViewResult()
|
1
|
Actionresult() is general result type that can have several subtypes.
|
Viewresult() renders a specified view to the response stream.
|
2
|
ActionResult() is an abstract class.
|
ViewResult() is a concrete class.
|
3
|
ActionResult() is a base class for ViewResult()
|
ViewResult() is a derived class for ActionResult()
|
4
|
In MVC framework it uses ActionResult() class to the reference the
object our action method returns and invoke Execute result method on it
|
ViewResult() is an implementation for this abstract class
(ActionResult class).It will try to find a view page (usually .aspx page) in
some predefined paths by the given
name.
|
5
|
In ActionResult() class are many subtypes-
·
ViewResult()
·
EmptyResult()
·
RedirectResult()
·
RedirectToRouteResult()
·
JSONResult()
·
JavaScriptResult()
·
ContentResult()
·
FileContentResult()
·
FileStraemResult()
|
As it is concrete class, so subtypes are not available for the
ViewResult() class.
|
No comments:
Post a Comment