ActionResult vs. View() vs. ViewResult :- MVC interview questions with answers

In case you are new to MVC you can start from this MVC training series videos created by

This is one of the most common interview question asked during MVC interviews.

Let’s take a look at how our MVC action method looks like.

      return View();

In above action method as you can see, return type is ActionResult but we are returning the return value of view() function.

View() function
As we already know our controllers are basically derived from “Controller” base class.
It contain a method called view().
Basically this function

  1. Finds a folder called [Controller Name] in Views Folder
  2. Then try to look for either aspx,asxc or cshtml page with name “MyAction” inside above folder.
  3. Create ViewReusult of obtained view and then returns. 

If view function returns ViewResults then why our action method return type is ActionResult?
It’s because ViewResult class internally inherits from ViewResultBase class which in turn inherited from ActionResult class.
We return ActionResult from Action methods because it gives us the power to return instance of any class derived from ActionResult.
Example –

publicActionResult MyAction(int id)
            return View();

Hope all of you have enjoyed reading this article.

Get live trainings on MVC,WCF,Design patterns, MSBI,WPF with live example. For detail visit




About c# and .NET Interview questions

This blog is for developers who want to crack .NET and C# interviews. It has all tips and tricks needed to crack .NET interviews , C# interview , SQL Server interview , Java interview , WCF Interview , Silverlight interview , WPF interview , LINQ interview , Entity framework Interview. Do not forget to watch our Learn step by step video series. Learn MVC in 16 hours:- Learn AngularJS Step by Step:- Learn Design Pattern in 8 hours:- Learn C# and .NET in 60 days:- Learn MSBI in 32 hours:- Learn SharePoint Step by Step in 8 hours:-
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

One Response to ActionResult vs. View() vs. ViewResult :- MVC interview questions with answers

  1. Johne368 says:

    hi!,I really like your writing so so much! proportion we communicate more about your post on AOL? I need a specialist on this space to unravel my problem. Maybe that’s you! Looking ahead to see you. edekceacadfb

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s