Scott Gu announced ASP.NET MVC 4 Developer Preview in last month BUILD Conference, lets have look at MVC 4 Developer preview.
We can install ASP.NET MVC 4 Developer Preview on top Visual Studio 2010 or Visual Studio 2011 Developer Preview. We can read ASP.NET MVC 4 Developer Preview Release Notes Here.
Create a new ASP.NET MVC 4 Internet Project, run the application:
First enhancement in ASP.NET MVC 4 Developer Preview is brand new modern looking website template. This brand new template has new jQuery model popup based login & registration screens.
Including to cosmetic changes new template has some functional improvements, new template uses adaptive rendering technique ,so that the same template looks good in all browsers (desktop, mobile, tablet) with any customizations.
Few more improvements in ASP.NET MVC 4 Developer Preview:
Mobile Project Template : New ASP.NET MVC 4 Project dialog includes a new template for creating sites targeting mobile browsers & tablet browsers. This template create a site optimized for touch based UI using jQuery Mobile Library.
Display Modes : Display Modes is one of the exciting feature where your application can select views depending on the browser that is making request.If a desktop browser requests the Home page, the application use the ViewsHomeIndex.cshtml template. If a mobile browser requests the Home page, the application might return the ViewsHomeIndex.mobile.cshtml template. We design the views even more specific to particular browsers.
If we want to create more specific views, layouts, or partial views for other devices, we can register a new DefaultDisplayMode instance in Global.asax Application_Start() method to specify which name to search for when a request satisfies particular conditions.
Here are the examples of few display modes :
How the display modes works : for example if we are requesting site home page in asp.net mvc 4 app from a iphone browser, then it will render view ~ViewsHomeIndex.iPhone.cshtml instead of ~ViewsHomeIndex.cshtml.
- jQuery Mobile, the View Switcher, and Browser Overriding
- Recipes for Code Generation in Visual Studio
- Task Support for Asynchronous Controllers
- ASP.NET MVC 4 Developer Preview supports the September 2011 1.5 release of the Windows Azure SDK
For info on above features refer to release notes, I will write detailed blog posts on each features.