Top 10 ASP.NET MVC Interview Questions

By | September 15, 2013

A must have list of ASP.NET MVC Interview Questions and Answers with concepts and necessary code examples. If you understand following key concepts, you will definitely feel more comfortable during an interview. But along with that you need to prepare your practical skills on ASP.NET MVC technology.You can also find more related implementation details here:

UPDATE: Although this tutorial targets top 10 most important and frequently asked interview questions but I have added few more questions at the end for readers to help them well prepare for ASP.NET MVC5 interview. Also, I have added Recent ASP.NET MVC Jobs at the end of this article that will definitely help you finding your dream job in Dubai, UAE.

ASP.NET MVC Interview Questions List

  1. Explain MVC (Model-View-Controller) in general?
  2. What is ASP.NET MVC?
  3. Difference between ASP.NET MVC and ASP.NET WebForms?
  4. What are the Core features of ASP.NET MVC?
  5. Can you please explain the request flow in ASP.NET MVC framework?
  6. What is Routing in ASP.NET MVC?
  7. What is the difference between ViewData, ViewBag and TempData?
  8. What are Action Methods in ASP.NET MVC?
  9. Explain the role of Model in ASP.NET MVC?
  10. What are Action Filters in ASP.NET MVC?

More Interview Questions….

1. Explain MVC (Model-View-Controller) in general?

MVC (Model-View-Controller) is an architectural software pattern that basically decouples various components of a web application. By using MVC pattern, we can develop applications that are more flexible to changes without affecting the other components of our application.

  •  “Model”, is basically domain data.
  •  “View”, is user interface to render domain data.
  •  “Controller”, translates user actions into appropriate operations performed on model.

MVC Architecture Back to top

2. What is ASP.NET MVC?

ASP.NET MVC is a web development framework from Microsoft that is based on MVC (Model-View-Controller) architectural design pattern. Microsoft has streamlined the development of MVC based applications using ASP.NET MVC framework.Understanding ASP.NET MVC Back to top

3. Difference between ASP.NET MVC and ASP.NET WebForms?

ASP.NET Web Forms uses Page controller pattern approach for rendering layout, whereas ASP.NET MVC uses Front controller approach. In case of Page controller approach, every page has its own controller i.e. code-behind file that processes the request. On the other hand, in ASP.NET MVC, a common controller for all pages processes the requests. Follow the link for the difference between the ASP.NET MVC and ASP.NET WebForms. Back to top

4. What are the Core features of ASP.NET MVC?

Core features of ASP.NET MVC framework are:

  • Clear separation of application concerns (Presentation and Business Logic). It reduces complexity that makes it ideal for large scale applications where multiple teams are working.
  • It’s an extensible as well as pluggable framework. We can plug components and further customize them easily.
  • It provides extensive support for URL Routing that helps to make friendly URLs (means friendly for human as well as Search Engines).
  • It supports for Test Driven Development (TDD) approach. In ASP.NET WebForms, testing support is dependent on Web Server but ASP.NET MVC makes it independent of Web Server, database or any other classes.
  • Support for existing ASP.NET features like membership and roles, authentication and authorization, provider model and caching etc.

Follow for detailed understanding of above mentioned core features.

Back to top

5. Can you please explain the request flow in ASP.NET MVC framework?

Request flow for ASP.NET MVC framework is as follows: Request hits the controller coming from client. Controller plays its role and decides which model to use in order to serve the request. Further passing that model to view which then transforms the model and generate an appropriate response that is rendered to client. ASP.NET MVC Request FlowYou can follow the link, in order to understand the Complete Application Life Cycle in ASP.NET MVC. Back to top

6. What is Routing in ASP.NET MVC?

In case of a typical ASP.NET application, incoming requests are mapped to physical files such as .aspx file. On the other hand, ASP.NET MVC framework uses friendly URLs that more easily describe user’s action but not mapped to physical files. Let’s see below URLs for both ASP.NET and ASP.NET MVC.

//ASP.NET  approach – Pointing to physical files (Student.aspx) //Displaying all students http://locahost:XXXX/Student.aspx //Displaying a student by Id = 5 http://locahost:XXXX/Student.aspx?Id=5
//ASP.NET MVC approach – Pointing to Controller i.e. Student //Displaying all students http://locahost:XXXX/Student //Displaying student by Id = 5 http://locahost:XXXX/Student/5/

ASP.NET MVC framework uses a routing engine, that maps URLs to controller classes. We can define routing rules for the engine, so that it can map incoming request URLs to appropriate controller. Practically, when a user types a URL in a browser window for an ASP.NET MVC application and presses “go” button, routing engine uses routing rules that are defined in Global.asax file in order to parse the URL and find out the path of corresponding controller. You can find complete details of ASP.NET MVC Routing here. Back to top

7. What is the difference between ViewData, ViewBag and TempData?

In order to pass data from controller to view and in next subsequent request, ASP.NET MVC framework provides different options i.e. ViewData, ViewBag and TempData. Both ViewBag and ViewData are used to to communicate between controller and corresponding view. But this communication is only for server call, it becomes null if redirect occurs.

So, in short, its a mechanism to maintain state between controller and corresponding view. ViewData is a dictionary object while ViewBag is a dynamic property (a new C# 4.0 feature). ViewData being a dictionary object is accessible using strings as keys and also requires typecasting for complex types. On the other hand, ViewBag doesn’t have typecasting and null checks. TempData is also a dictionary object that stays for the time of an HTTP Request. So, Tempdata can be used to maintain data between redirects i.e from one controller to the other controller.ViewData Vs ViewBag Vs TempData You can easily find detailed examples for implementation of ViewBag, ViewData and TempData here. Back to top

So are you comfortable with ASP.NET MVC Now? Let’s test your ASP.NET MVC Skill.

  Please choose the correct statements about ViewBag and ViewData [Choose Two]?

  • A. ViewData is a Dictionary object and it requires typecasting while getting data.
  • B. ViewData is a Dynamic Property so it doesn’t require typecasting for getting data.
  • C. ViewBag is a Dictionary object and it requires typecasting while getting data.
  • D. ViewBag is a Dynamic Property so it doesn’t require typecasting for getting data.

 Correct Answer: A, D

If you want to further test your ASP.NET MVC skill, Take a Complete FREE Online Test or MCSD Practice Exam: 70-486 (Developing ASP.NET MVC Web Applications). Simply Click Here.

8. What are Action Methods in ASP.NET MVC?

As I already explained about request flow in ASP.NET MVC framework that request coming from client hits controller first. Actually MVC application determines the corresponding controller by using routing rules defined in Global.asax. And controllers have specific methods for each user actions. Each request coming to controller is for a specific Action Method. The following code sample, “ShowBook” is an example of an Action Method.

  public ViewResult ShowBook(int id)   {            var computerBook = db.Books.Where(p => P.BookID == id).First();            return View(computerBook);   }

Action methods perform certain operation using Model and return result back to View. As in above example, ShowBook is an action method that takes an Id as input, fetch specific book data and returns back to View as ViewResult. In ASP.NET MVC, we have many built-in ActionResults type:

  • ViewResult
  • PartialViewResult
  • RedirectResult
  • RedirectToRouteResult
  • ContentResult
  • JsonResult
  • EmptyResult
  • and many more….

For a complete list of available ActionResults types with Helper methods, please click here. Important Note: All public methods of a Controller in ASP.NET MVC framework are considered to be Action Methods by default. If we want our controller to have a Non Action Method, we need to explicitly mark it with NonAction attribute as follows:

[NonAction] public void MyNonActionMethod() { ….. }

Back to top

9.Explain the role of Model in ASP.NET MVC?

One of the core feature of ASP.NET MVC is that it separates the input and UI logic from business logic. Role of Model in ASP.NET MVC is to contain all application logic including validation, business and data access logic except view i.e. input and controller i.e UI logic. Model is normally responsible for accessing data from some persistent medium like database and manipulate it, so you can expect that interviewer can ask questions on database access topics here along with ASP.NET MVC Interview Questions. Back to top

10.What are Action Filters in ASP.NET MVC?

If we need to apply some specific logic before or after action methods, we use action filters. We can apply these action filters to a controller or a specific controller action. Action filters are basically custom classes that provide a mean for adding pre-action or post-action behavior to controller actions.Action Filters in ASP.NET MVCFor example,

  • Authorize filter can be used to restrict access to a specific user or a role.
  • OutputCache filter can cache the output of a controller action for a specific duration.
  • and more…

Back to top

Download PDF Version of this article here.

  • Learn ASP NET MVC 5 step by step [Maruti Makwana, Corporate Trainer] 28 Lectures, 2.5 Hours Video, Intermediate Level Very easy to learn video series on Asp.Net MVC 5 Specially for those who are familiar with Asp.Net Web forms.
  • AngularJS for ASP.NET MVC Developers [Brett Romero] 10 Lectures, 1 hour video, Intermediate Level The Fastest Way For .NET Developers To Add AngularJS To Their Resume
  • ASP.NET with Entity Framework from Scratch [Manzoor Ahmad, MCPD | MCT] 77 Lectures, 10 hour video, All Level Latest approach of web application development
  • Comprehensive ASP.NET MVC [3D BUZZ] 34 lectures, 14 Hours Video, All Levels From zero knowledge of ASP.NET to deploying a complete project to production.

More Interview Questions on ASP.NET MVC

What are the new features introduced in ASP.NET MVC5?

ASP.NET MVC5 was introduced with following exciting features:

For details on above ASP.NET MVC5 new features, kindly follow here. Back to top

What is a ViewEngine in ASP.NET MVC?

“View Engine in ASP.NET MVC is used to translate our views to HTML and then render to browser.” There are few View Engines available for ASP.NET MVC but commonly used View Engines are Razor, Web Forms/ASPX, NHaml and Spark etc. Most of the developers are familiar with Web Forms View Engine (ASPX) and Razor View Engine.

  • Web Form View Engine was with ASP.NET MVC since beginning.
  • Razor View Engine was introduced later in MVC3.
  • NHaml is an open source view engine since 2007.
  • Spark is also an open source since 2008.

Note: For a detailed comparison between Web Form View Engine and Razor View Engine, please follow here. ASP.NET MVC View EngineBack to top

What is the difference between Razor View Engine and ASPX View Engine?

I have written a separate detailed blog post to understand the  Difference between ASPX View Engine and Razor View Engine. You can follow the link to get detailed step by step description  here. Most important differences are listed below:

ASPX View Engine

Razor View Engine

WebForms View Engine uses namespace “System.Web.Mvc.WebFormViewEngine”. “System.Web.Razor” is the namespace for Razor View Engine.
Comparatively fast. A little bit slower than ASPX View Engine.
Nothing like Test Driven Development Good support for Test Driven Development.
Syntax for ASPX View Engine is inherited from Web Forms pages as: <%= employee.FullName %> Syntax for Razor View Engine is comparatively less and clean. @employee.FullName

Back to top

What is a ViewModel in ASP.NET MVC?

A ViewModel basically acts as a single model object for multiple domain models, facilitating to have only one optimized object for View to render. Below diagram clearly express the idea of ViewModel in ASP.NET MVC:ViewModel in ASP.NET MVC There are multiple scenarios where using ViewModel becomes obvious choice. For example:

  • Parent-Child View Scenario
  • Reports where often aggregated data required
  • Model object having lookup data
  • Dashboards displaying data from multiple sources

Back to top

What are ASP.NET MVC HtmlHelpers?

ASP.NET MVC HtmlHelpers fulfills almost the same purpose as that of ASP.NET Web From Controls. For imlementation point of view, HtmlHelper basically is a method that returns a string ( i.e. an HTML string to render HTML tags). So, in ASP.NET MVC we have HtmlHelpers for links, Images and for Html form elements etc. as follows:

@Html.ActionLink(“WebDev Consulting Company Profile”, “CompanyInfo”) will render: <a href=”/Site/CompanyInfo”>WebDev Consulting Company Profile</a>
@Html.TextBox(“strEmployeeName”) renders: <input id=”strEmployeeName” name=”strEmployeeName” type=”text” value=”” />

For a complete reference to Standard ASP.NET MVC Html Helpers, Click Here.

Note: Html Helpers are comparatively lightweight because these don’t have ViewState and event model as for ASP.NET Web Form Controls.

We can also create our Custom Html Helpers to fulfill specific application requirements. There are 2 ways to create custom HtmlHelpers as follows:Custom Html Helpers Back to top

What is Bootstrap in MVC5?

Bootstrap (a front-end framework) is an open source collection of tools that contains HTML and CSS-based design templates along with Javascript to create a responsive design for web applications. Bootstrap provides a base collection including layouts, base CSS, JavaScript widgets, customizable components and plugins. Project Template in ASP.NET MVC5 is now using bootstrap that enhances look and feel with easy customization. Bootstrap version 3 is added to ASP.NET MVC5 template as shown below:Bootstrap Template in MVC5

Note: You can follow here to learn step by step how we can use any theme in Bootstraps to our ASP.NET MVC web application. If you are further interested to learn Bootstrap in much detailed level, a very comprehensive course is available that teaches you bootstrap by building 10 professional projects.

Back to top

Kindly explain Attribute Routing in ASP.NET MVC5?

We already have discussed about Routing in Question#6 that in ASP.NET MVC, we use friendly URLs that are mapped to controller’s actions instead of physical files as in case of ASP.NET WebForms. Now in ASP.NET MVC5, we can use attributes to define routes giving better control over the URIs. We can easily define routes with Controller’s action methods as follows:Attribute Routing in MVC5

Note: Remember that conventional routing approach is not discarded, it’s still there and fully functional. Also, we can use both routing techniques in a same application. Click here for more details on Attribute Routing.

Back to top

What is Scaffolding in ASP.NET MVC? and what are the advantages of using it?

We (developers) spent most of our time writing code for CRUD operations that is connecting to a database and performing operations like Create, Retrieve, Update and Delete. Microsoft introduces a very powerful feature called Scaffolding that does the job of writing CRUD operations code for us.

Scaffolding is basically a Code Generation framework. Scaffolding Engine generates basic controllers as well as views for the models using Micrsoft’s T4 template. Scaffolding blends with Entity Framework and creates the instance for the mapped entity model and generates code of all CRUD Operations. As a result we get the basic structure for a tedious and repeatative task. You can find a detailed Web Development Tutorial with implementation on ASP.NET MVC Scaffolding here.
ASP.NET MVC Scaffolding
Following are the few advantages of Scaffolding:

  • RAD approach for data-driven web applications.
  • Minimal effort to improve the Views.
  • Data Validation based on database schema.
  • Easily created filters for foreign key or boolean fields.

Back to top

Consider you are working as MVC Developer with WebDevTutorials. Our ASP.NET MVC application has a controller named EmployeeController. We want our EmployeeController to have a public non action method. What we will do to achieve this?

  • A. We can’t make a public method as non action in ASP.NET MVC.
  • B. Make return type void to a public method.
  • C. Add NonActionAttribute attribute to a public method.
  • D. Add VoidAttribute attribute to a public method.

Want to improve you ASP.NET MVC skill, Take a Complete FREE Online ASP.NET MVC Test or MCSD Practice Exam: 70-486 (Developing ASP.NET MVC Web Applications). Simply Click Here.

 Correct Answer: C

Briefly explain ASP.NET Identity?

Microsoft introduces ASP.NET Identity as a system to manage access in ASP.NET application on premises and also in the cloud. There were issues with Membership Provider Model especially when we want to implement more advanced security features in our applications, so ASP.NET Identity gets away from the membership provider model. If we look into the history of membership, its like follows:

  • ASP.NET 2.0 Membership (VS 2005)
    • Forms Authentication
    • Sql Server Based Membership
  • ASP.NET Simple Membership (VS 2010)
    • Easy to customize profile
    • ASP.NET Web Pages
  • ASP.NET Universal Providers (VS2012)
    • Support Sql Azure

ASP.NET Identity is much improved system to manage access to our application and services.ASP.NET Identity For more information on ASP.NET Identity, please follow here. Back to top

ASP.NET MVC is an amazing framework for developing applications. Above mentioned  ASP.NET MVC interview questions must be prepared before appearing for a MVC interview.

ASP.NET MVC Jobs [Updated Daily]


GIS Developer
Source: Indeed
Details: ASP.Net MVC – VB.Net and C#. Geospatial Solutions Developer Junior -10892....  More
11 hours ago

Madison, WI 29-August-2016

.Net Developer
Source: Indeed
Details: MVC. We are looking for a few well rounded developers to help with our .Net web development applications....  More
3 days ago

Carrollton, GA 30117 26-August-2016

Fulltime- Perm Jr/Mid level. Front end developer
Source: Indeed
Details: JQuery, Knockout.js, etc.)ASP.NET MVC, Entity Framework. A proven track record of developing websites using technologies such as HTML5, CSS3, JavaScript, AJAX,...  More
4 days ago

Boston, MA 25-August-2016

.NET Developer
Source: Indeed
Details: ASP.NET MVC 4+, Web API, Fluent Nhibernate. Software Analysis, Design, Development, and maintain modern web applications using a mix of open source and closed...  More
4 days ago

Rogers, AR 72756 25-August-2016

Software Engineer
Source: Clarity Consulting
Details: C# / WinRT / .NET / XAML / Windows 8/8.1/10 / Windows Phone 8/8.1 / Xbox / iOS / Cocoa Objective-C / Android / HTML5 / JavaScript/jQuery / CSS3 / ASP.NET MVC /...  More
13 days ago

Seattle, WA 16-August-2016

Junior Developer
Source: Indeed
Details: Experience with MVC. We are looking for a junior developer to create and maintain existing .net desktop and web applications....  More
10 days ago

Albuquerque, NM 19-August-2016

ASP.NET Developer - onsite/remote/FT/Contract
Source: Indeed
Details: Familiarity with, MVC, SQL, HTML, JavaScript and CSS is helpful. GeekHive is looking to expand its team and has opportunities for full-stack, back-end...  More
10 days ago

Warwick, NY 10990 19-August-2016

.Net/Software Developer
Source: Indeed
Details: Have worked with ASP.NET, MVC*. Design ASP type pages for both display and server processing*. Develop programs for Global Treasury Manager project....  More
10 days ago

Hartford, CT 19-August-2016

Mid-Level Software Developer - .NET
Source: Indeed
Details: Develop new and maintain existing software using the ASP.NET / MVC platform. Demonstrated experience developing web-based applications using .Net framework 3.5...  More
11 days ago

San Diego, CA 18-August-2016

Sr .Net Developer
Source: Adept Solutions
Details: ASP.NET MVC development experience (4 yrs minimum) C# development experience (4 yrs minimum) SQL Server 2012 development & support experience (4 yrs minimum)....  More
18 days ago

Dearborn, MI 48120 11-August-2016

Software Engineer II
Source: Indeed
Details: 3+ years experience, Microsoft .Net, C# and ASP.Net MVC. The Development Team....  More
6 hours ago

Irvine, CA 29-August-2016

Full Stack Developer
Source: Graphic Products
Details: Proficient knowledge of ASP.NET MVC 5+. We are looking for a Full Stack Developer responsible for the ongoing development and advancements of our ecommerce and...  More
18 days ago

Beaverton, OR 97008 11-August-2016

Here we grow again-Software Engineer
Source: Indeed
Details: Experience in building ASP.NET MVC applications. This is a full time position as a Software Engineer with a major financial company in downtown Detroit....  More
3 days ago

Detroit, MI 26-August-2016

Application Developer - Secret Clearance Required
Source: Indeed
Details: ASP.NET MVC, Entity Framework (or other ORM), JavaScript, XML, JSON, Web API, and Powershell. (SECRET Clearance Required)*....  More
18 days ago

Reston, VA 11-August-2016

Consulting Software Engineer
Source: Indeed
Details: MVC 3/4, Unit Testing/MS Unit, TFS, JavaScript, AJAX. This position provides assistance and input to management, develops and leads large multi functional...  More
30+ days ago

Raleigh, NC 12-July-2016

Software Reverse Engineer
Source: Indeed
Details: Minimum 5 years development background using C#, ASP.NET, MVC, WPF. Software Reverse Engineer*....  More
4 days ago

Columbus, OH 25-August-2016

.Net Developer
Source: Indeed
Details: Knowledge of ASP.NET MVC. Knowledge of Object Oriented (OO) design patterns....  More
11 days ago

Columbia, MD 18-August-2016

Software Engineer
Source: Indeed
Details: C# -ASP.Net MVC 5+. THIS IS A DIRECT HIRE ROLE - NO C2C PLEASE!*....  More
4 days ago

Birmingham, AL 25-August-2016

.Net Developer
Source: Indeed
Details: C# • .NET 4.0, ASP.NET MVC 4 with Razor Templates • MS Unity • MS Visual Studio• OO Design Patterns • Web Services, REST, JSON, AJAX • JavaScript, JQuery • XML,...  More
19 days ago

Rochester, NY 10-August-2016

Apple, Android, C#, cross-platform mobile developer
Source: Indeed
Details: C# .Net web development (Windows phone, C# Xamarin cross-platform mobile development, ASP.NET MVC Framework)....  More
19 days ago

Miami, FL 33132 10-August-2016

Mid-Level .Net Developer
Source: Centare
Details: ASP.NET MVC or WebForms. We are currently looking to add a Mid-Level .Net Developer to our team in Madison....  More
20 days ago

Madison, WI 09-August-2016

.NET Sr.Consultant.
Source: Indeed
Details: C# development and .NET technology, including ASP.NET MVC is big plus. Full time after 6 Months Contract (Contract to Hire)....  More
10 hours ago

Dallas, TX 29-August-2016

16-03-108 Software Engineer- Web development
Source: Indeed
Details: Working knowledge of .NET including C#, ASP.NET MVC, and ADO.NET, required. This is a key position within the Avastone Technologies organization responsible for...  More
6 days ago

Little Chute, WI 54140 23-August-2016

Software Engineer
Source: Indeed
Details: ChoiceOne EHR, Inc. was founded in 2008 by long time veterans of the medical practice administration and medical billing industry. Because ChoiceOne EHR, Inc.  More
7 days ago

Cerritos, CA 22-August-2016

Software Engineer C#/ASP.NET MVC/JavaScript
Source: Cormant, Inc.
Details: You will be working on full stack development including Marionette client, and a C# MVC architecture with NHibernate/RDBMS as the back-end....  More
7 days ago

San Luis Obispo, CA 22-August-2016

MCSD - Web Applications

More You Must Read about ASP.NET MVC & Related

Top 10 Interview Questions and Answers Series:

Category: ASP.NET MVC Interview Questions Tags: ,


Imran Abdul Ghani is working as Software Developer(Senior) with extensive knowledge in Web development technologies especially C#, ASP.NET, MVC, WCF, Web API, ADO.NET Entity Framework, jQuery etc. He has several years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET (MCSD.NET) since 2005. You can reach his blogging at,, and

  • This comment has been removed by a blog administrator.

  • The questions are quite simple. I used to work for Microsoft. We ask more questions on extending MVC framework. How will you create a Custom Controller Factory? What are the limitations of the Default Model Binder? How will you use MVC with IoC containers? etc.

  • You are right to some extent. We may go in details for more complex questions but will always start with a key main area and then move forward depending the candidate’s knowledge. That’s why I said, its top 10 questions every ASP.NET MVC developer must know.

  • Dear Imran,
    I have started learning MVC recently

    Please can you explain in MVC 4 how to show the data related to multiple entities in a single view.
    should it be by using ViewModel.
    or give a url link which has the source code or easy to understand.

    For ex: Country,City,State are the 3 entities in Database, and i need to show in view in below format
    Country Name, State Name, District ..

    DataBase First approach should be OK.
    Please do the needfull.
    My mail id is

  • Dear Udaya,
    You will find such examples on MVC in my future articles here in this blog but focus will be MVC 5. You need to follow by Email so that you get the updated results. For specifically on MVC 4, you can google. I’ll try to provide if I find some relevant material.


  • Shree Patel

    i m new in MVC. i have created an index page of leave application of employees. Single employee has multiple leave types like CL,SL,CML,etc. The index page contains empid (Foreign Key), emp name,different leave types(Foreign Key) with their balance and SNO(i.e the primary key ). I will attach an image of the index page. when i click to edit the record it should redirect to edit page with the primary key but i want to pass multiple values(i.e different primary keys). So, i m stucked here. Please help him to resolve my problem.

  • Sandip Shelake

    good source

  • priyanka bebo

    Hi …this is priyanka i am learning mvc framework im struggling to get the answer can you help me out this.
    My requirement is i have two textboxes and one dropdown(1year,2years,3years).one textbox is start date another is Expiredate.if i select dropdown values like 1year then the Expire date will be startdate+1year How should i get this………..
    Thanks in Advance