If you’re hiring and planning a .NET Interview, you’ll also be prepared for ASP.NET MVC interview questions to get the best developers for your company. ASP.NET MVC is the framework utilized to construct Web applications for .NET and C#. In this article, I have listed best 10 ASP.NET MVC questions and their answers.
1. Have you ever implemented MVC? What do you think it is more appropriate for, Web or Windows Application?
Yes, I have implemented MVC practically several times. According to my knowledge MVC is a appropriate architecture while creating web applications due to division of concerns. We can utilize MVP (Model View Presenter) architecture for Windows application.
2. How ASP.NET MVC and ASP.NET WebForms are different ?
WebForms need separation of concerns, which implies the code and .aspx page are firmly associated with each other. This creates errors when the developer attempts to alter one without impacting other. However, ASP.NET MVC has a separation of concerns, which suggests that one perspective or component can be changed without disturbing other.
3. What do you mean by MVC routing ?
The URLs in ASP.NET MVC are mapped to action methods and controller rather than physical files of the system. To precisely map action methods and controller to URLs, the routing engine shapes fitting courses. Utilizing this, the controllers can handle particular requests.
Here’s the best interpretation of routing:
request > routing engines > routes > controller & action methods
4. What are action methods ?
Controllers characterize action strategies for URL mapping. Each request received by the MVC application is managed and reacted to by activity strategies.
5. Explain MVC page lifecycle
The steps of MVC page life cycle are:
- Request interferences by URLRoutingModule
- MVC handler execution
- Controller execution
- Render view method execution
6. What is Razor View Engine?
Through view engines, web pages can use server-side codes which are server compiled before sending to the browser. The default view engine of ASP.NET MVC is Razor. For C# code, it uses cshtml extension and for vb.net code, vbhtml extension.
7. By which method you can enable attribute writing ?
To enable attribute routing, simply include MapMvcAttributeRoutes() method to the code.
8. Explain Filters? Tell me some of the filters? Which one will be executed in the last?
Filters are used to characterize logic that should be performed either after or before action method execution.
Some MVC filters are:
- Authorisation filter
- Action filter
- Result filter
- Exception filter
Execution filter is executed in the last.
9. Explain HelperPage.IsAjax property?
To know whether Ajax is being used at the time of webpage request, HelperPage.IsAjax property is used.
10. Do you know what Is ActionName? Have you ever implemented it practicaly?
Yes, I have implemented it several times. ActionName is an attribute used to alter the action name. Here’s how it is utilized in code:
public ActionResult Test()
Frequently inquired MVC meet questions simply shouldn’t miss.
- What do you mean by TempData, ViewBag, and ViewData?
- Explain request flow in MVC application?
- Explain MVC Scaffolding?
- How can you manage the Action Method’s unhandled exceptions?
- Explain View Engine?
- Explain Model Binding?
- What do you mean by MVC Output Caching?
- Explain HTML Helpers?
- Explain MVC RenderPage and RenderBody?
- Explain HelperPage. Is Ajax property?
- What is JSON binding?
- What is Bundle.Config?
- Explain MVC Layout and Sections?