Asp.net MVC Interview Questions

Asp.net MVC Interview Questions :



Here we give List of Questions of asp.net MVC model. These are very Impotent in Interview. 

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

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

3. Difference between ASP.NET MVC & 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.more About difference in webform & MVC. And Diffrence between ASP.NET MVC 5 and MVC 6.

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)
  • An extensible and pluggable framework
  • Extensive support for ASP.NET Routing
  • Support for existing ASP.NET features

5. 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. ASP.NET MVC framework uses friendly URLs that more easily describe user’s action but not mapped to physical files.
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 ASP.NET MVC Routing further details here.

6. 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 View Bag and View Data are used to communicate between controller and corresponding view. But this communication is only for server call, it becomes null if redirect occurs. So, in short, it’s a mechanism to maintain state between controller and corresponding view.

View Data is a dictionary object while ViewBag is a dynamic property (a new C# 4.0 feature). View Data being a dictionary object is accessible using strings as keys and also requires typecasting for complex types. On the other hand, View Bag doesn’t have typecasting and null checks.
Temp Data is also a dictionary object that stays for the time of an HTTP Request. So, Temp data can be used to maintain data between redirects i.e. from one controller to the other controller.

Comments