Microsoft has added exciting features in every new version of ASP.NET MVC that make developers more comfortable building scalable web applications easily. In this ASP.NET MVC tutorial, we will have a quick look into new and important features introduced in major versions of Microsoft ASP.NET MVC starting from MVC3 to MVC5 (the latest one so far).
MVC3 Vs MVC4 Vs MVC5
Note: If you wanted to get a practical example for building your first ASP.NET MVC 5 Application using Entity Framework, please follow here.
- New Project Templates having support for HTML 5 and CSS 3.
- Improved Model validation.
- Razor View Engine introduced with a bundle of new features.
- Having support for Multiple View Engines i.e. Web Forms view engine, Razor or open source. You can follow here for a detailed comparison on difference between WebForm View Engine and Razor View Engine.
- Controller improvements like ViewBag dynamic property and ActionResults Types etc. Dynamic property is a new feature introduced in C# 4.0. ViewBag being a dynamic property has an advantage over ViewData that it doesn’t require checking NULL values. For detailed difference between ViewBag and ViewData can be found here.
- Improved Dependency Injection with new IDependencyResolver.
- Partial page output caching.
ASP.NET MVC 4
- ASP.NET Web API, a framework that simplifies the creation of HTTP services and serving a wide range of clients. Follow to create your first ASP.NET Web API service.
- Adaptive rendering and other look-n-feel improvements to Default Project Templates.
- A truly Empty Project Template.
- Based on jQuery Mobile, new Mobile Project Template introduced.
- Support for adding controller to other project folders also.
- Task Support for Asynchronous Controllers.
- Controlling Bundling and Minification through web.config.
- Support for OAuth and OpenID logins using DotNetOpenAuth library.
- Support for Windows Azure SDK 1.6 and new releases.
- ASP.NET Identity for authentication and identity management. Thesedays, modern applications are developed for broader range of clients such as web, mobile in mind. Also, users are actively using their social identities from various social channels like facebook, youtube, twitter etc. ASP.NET Identity is a new Membership system to handle authentication and authorization for variety of clients as well as using user’s existing social identities.
- Authentication Filters for authenticating user by custom or third-party authentication provider.
- With the help of Filter overrides, we can now override filters on a method or controller.
- Bootstrap replaced the default MVC template.
- Attribute Routing is now integrated into MVC5. Basically, MVC Routing is an excellent way to create human friendly and Search Engine Optimized URLs. You can easily get understanding about Routing in ASP.NET MVC here. Attribute based routing enables us to define routes along with action methods as follows:
public ActionResult GetStudentById(string id)
// code logic here.
Hopefully, this article will help you in comparing core features of ASP.NET MVC in different versions.
Other Related Articles:
- ViewBag Vs ViewData Vs TempData in ASP.NET MVC
- Free Practical Guide to ASP.NET Web API
- 7 jQuery code snippets every web developer must have
- Difference between WCF and ASMX web service
- WCF Hosting (Console | Windows Service)
- New features in ASP.NET Web API 2
- WebForms Vs MVC
Top 10 Interview Questions and Answers Series:
- Top 10 HTML5 Interview Questions
- Top 10 ASP.NET Interview Questions
- Comprehensive Series of ASP.NET Interview Questions
- Top 10 ASP.NET MVC Interview Questions
- Top 10 ASP.NET Web API Interview Questions
- Top 10 ASP.NET AJAX Interview Questions
- Top 10 WCF Interview Questions
- Comprehensive Series of WCF Interview Questions
- a Must Have SharePoint Interview Questions