What is Attribute Routing and how to define it?

ASP.NET MVC5 and WEB API 2 supports a new type of routing, called attribute routing. In this routing, attributes are used to define routes. Attribute routing provides you more control over the URIs by defining routes directly on actions and controllers in your ASP.NET MVC application and WEB API. Controller… Continue reading

How to define a route in ASP.NET MVC?

You can define a route in ASP.NET MVC as given below: public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute(“Default”, // Route name “{controller}/{action}/{id}”, // Route Pattern new { controller = “Home”, action = “Index”, id = UrlParameter.Optional } // Default values for above defined parameters ); } protected void Application_Start() {… Continue reading

Explain ASP.NET MVC pipeline?

The detail ASP.NET MVC pipeline is given below: Routing – Routing is the first step in ASP.NET MVC pipeline. Typically, it is a pattern matching system that matches the incoming request to the registered URL patterns in the Route Table. The UrlRoutingModule(System.Web.Routing.UrlRoutingModule) is a class which matches an incoming HTTP… Continue reading

What is ViewModel in ASP.NET MVC?

In ASP.NET MVC, ViewModel is a class that contains the fields which are represented in the strongly-typed view. It is used to pass data from controller to strongly-typed view. Key Points about ViewModel ViewModel contain fields that are represented in the view (for LabelFor, EditorFor, DisplayFor helpers) ViewModel can have… Continue reading

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

The main differences between ASP.NET Web Form and ASP.NET MVC are given below: ASP.NET Web Forms ASP.NET MVC ASP.NET Web Form follows a traditional event driven development model. ASP.NET MVC is a lightweight and follow MVC (Model, View, and Controller) pattern based development model. ASP.NET Web Form has server controls…. Continue reading

What is difference between 3-layer architecture and MVC architecture?

3-layer architecture separates the application into 3 components which consists of Presentation Layer Business Layer and Data Access Layer. In 3-layer architecture, user interacts with the Presentation layer. 3-layer is a linear architecture. MVC architecture separates the application into three components which consists of Model, View and Controller. In MVC… Continue reading

Explain brief history of ASP.NET MVC?

Here is the list of released version history of ASP.NET MVC Framework with theirs features. ASP.NET MVC1 Released on Mar 13, 2009 Runs on .NET 3.5 and with Visual Studio 2008 & Visual Studio 2008 SP1 MVC Pattern architecture with WebForm Engine Html Helpers Ajax helpers Routing Unit Testing ASP.NET… Continue reading

What are advantages of ASP.NET MVC?

There are following advantages of ASP.NET MVC over Web Forms (ASP.NET): Separation of concern – MVC design pattern divides the ASP.NET MVC application into three main aspects Model, View and Controller which make it easier to manage the application complexity. TDD – The MVC framework brings better support to test-driven… Continue reading

How Model, View and Controller communicate with each other in ASP.NET MVC?

There are following rules for communication among Model, View and Controller: User interacts with the Controller. There is one-to-many relationship between Controller and View means one controller can mapped to multiple views. Controller and View can have a reference to model. Controller and View can talk to each other. Model… Continue reading