In previous posts, we provided you list of C# Interview Questions and OOPS Interview Questions but now in this we will be focusing on complete ASP.NET MVC interview questions, which will help to gain some more knowledge in MVC before proceeding with an interview.

What is ASP.NET MVC?

ASP.NET MVC is web-application development framework, which can be used to create any type of web-application, whether it is E-Commerce or some large scalable web application and it is easily testable.

MVC seperates application code in three parts, that is, Model-View-Controller.

What do you understand by Model View Controller (MVC)?

MVC is a software architecture or application design model, containing 3 interconnected layers.

These 3 layers are the:

  • Model : which acts as layer of data connected to application
  • View: Layer, which is the user interface of an MVC application
  • Controller: Layer, the processes that are responsible for handling the input and output, and also handles database connectivity of application.

What do you mean by Razor in MVC?

Razor was introduced in MVC 3, and Razor View engine is a markup syntax which helps us to write HTML and server-side code in web pages using C# or VB.NET. 

It is a templating engine and ASP.NET MVC has implemented this view engine which allows us to use Razor inside of an MVC application to produce HTML.

Main focus of Razor is to produce simple and code-focused templating for HTML generation.

What is difference between ASP.NET MVC and ASP.NET WebForms?

ASP.NET Web-Forms, at its most basic level, provides a means for you to provide general HTML markup combined with server side "controls" within the event-driven programming model that can be leveraged with VB, C#, and so on. You define the pages of a site, drop in the controls, and provide the programmatic plumbing to make it all work.

ASP.NET WebForms lack separation of concerns, which means the code and .aspx page are tightly associated with each other.

ASP.NET MVC provides a mechanism for designing a site around a pre-determined "pattern" of application access, basically it has a separation of concerns, which means that one aspect or component can be changed without disturbing other.

What is Routing in MVC?

The URL's in ASP.NET MVC are mapped to Action Methods and Controller. To accurately map action methods and controller to URLs, the routing engine forms appropriate routes. Using this, the controllers can handle specific requests.


Explain about MVC life-cycle?

The steps of MVC page life cycle are:

  • Routing
  • Controller Initialization
  • Action Execution
  • Result Execution
  • Render view method execution

Below is explanation using Flow Diagram.


What are Actions in MVC?

Actions are methods in Controller Class which returns View/PartialView or JSON based on requirements.

Action Usually have return type "ActionMethod" to return View(.cshtml Razor View, with Model) to user.

What is Attribute Routing in MVC?

Attribute routing is supported in both Web-API and MVC. This was introduced in MVC5.

In this type of routing, attributes are being used to define the routes or you can say URL for ActionMethod. This type of routing gives more control over classic URI Routing.


public ActionResult ShowProduct(int productId) {
//some code

How do you Enable Attribute Routing?

To enable attribute routing, simply calll MapMvcAttributeRoutes in RouteConfig.cs

public class RouteConfig
    public static void RegisterRoutes(RouteCollection routes)

        //to enable attribute route