17 May 2016 Sudhanshu Ranjan 757

Difference Between ViewResult() and ActionResult() in MVC ?

I Hope you will be confused about both but I will clear your doubt.

“ActionResult is an abstract parent class from which ViewResult class has been derived”.

There are 11 different response types which can be sent to the end user. All are inherited to ActionResult class.

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 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

You can share at :

About Author
Sudhanshu Kumar Ranjan | Lead Engineer at HCL Technologies | Expertise in Microsoft Technology | Author | Blogger | Programmer
Know More
Connect with him on Facebook | Google+ | LinkedIn | Twitter

Recommended Post

Leave a comment

About Dotnet Cube

It's my blog - Dotnet Cube, where you will learn and get solutions about programming, web designing and development. I started this website to share my knowledge and experience which might help someone.

You can get more details about me and my blog at About Us page.

Subscribe Newsletter

Subscribe to our monthly newsletter to get the latest industry news, Media Group updates and our current specials.

Follow On Us...

Home | About | Advertise | Copyrights | Privacy | Contact | Admin

Copyrights © 2015-2017 dotnetcube.com. All rights reserved