ASP.NET MVC 5 is the a major new release which has introduced new features as below:
1) One ASP.NET
On selecting a New Project from the VS 2013 unlike in previous version we will see one template called ASP.NET Web Application.After you click the OK button,next popup options to select a starting web project template.
The options to include Web Forms, MVC, Web API, and add a unit test.This unification reinforces to think of ASP.NET Web applications as one technology providing us different building blocks for making web applications.
2) Bootstrap
ASP.NET MVC 5 provides Bootstrap support out of the box. When we create a new MVC or Web Form project, the Bootstrap CSS files get added to the style folder and the layout page will be setup to use the Bootstrap classes.
3) Attribute Based Routing
We can now directly attach the route to the action method.Following is an example of a route defined using the Route attribute.
[Route("Catalogue/Item/{id}")]
public ActionResult GetItem(string id)
{
ViewBag.Id = id;
return View();
}
To enable attribute based routing the following changes need to be done to the RouteConfig file.
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapMvcAttributeRoutes();
}
Now our action method will be able to handle the requests which match as per the URL pattern defined by the Route attribute.
4) ASP.NET Identity
ASP.NET MVC 5 has introduced a flexible identity management mechanism. Identity and authentication management is built into the framework now.Also, MVC 5 provides authentication and logic features via third party applications such as Facebook, Google and Twitter, right out of the box.
5) Authentication Filters
Authentication filters are a new kind of filter in ASP.NET MVC. These filters run before authorization filters in the ASP.NET MVC pipeline.We can use these filters to specify authentication logic per action basis, per controller basis and globally for all controllers.
6) Filter Overrides
A good definition of filter overrides is available in release notes, "You can now override which filters apply to a given action method or controller, by specifying an override filter.
Override filters specify a set of filter types that should not run for a given scope (action or controller). This allows you to add global filters, but then exclude some from specific actions or controllers".
0 Comment(s)