I read Programming ASP.NET MVC 4, Developing Real-World Applications with ASP.NET MVC, as part of the O'Reilly Blogger Review Program. This is the first ASP.NET MVC 4 book I have read thus far and it contains a lot of information on ASP.NET MVC and the new features in ASP.NET MVC 4. It not only discusses ASP.NET MVC, but discusses best practices, design patterns, and various programming principles.
Contents tagged with asp.net mvc 4 tutorials
Awhile ago I mentioned how Orchard 1.6 will be running ASP.NET MVC 4, ASP.NET Web API, and NHibernate 3. I have already covered ASP.NET Web API in more detail in one of my ASP.NET MVC 4 Tutorials, ASP.NET MVC 4 Web API Routes and ApiController, but I thought I would at least give Web API a quick shoutout with Orchard CMS. As with all things Orchard, Web API works exactly as you would expect and can take advantage of the various services and extensions that come with Orchard.
I've been writing a number of ASP.NET MVC 4 Tutorials on new features as I either come across them or use them. One of the new features in ASP.NET MVC 4 is the AllowAnonymous Attribute that helps you secure an entire ASP.NET MVC 4 Website or Controller while providing a convenient means of allowing anonymous users access to certain controller actions, like the login and register Actions. If you look at the AccountController in a default ASP.NET MVC 4 Internet Project you will see AllowAnonymous Attributes sprinkled throughout various login and register controller actions for this very reason.
ASP.NET MVC 4 and the Razor View Engine v2 were released in beta awhile back with some pretty nice features like ASP.NET MVC 4 Bundling and Minification, EF Data Migrations, and ASP.NET Web API. You can find all of this in my ASP.NET MVC 4 Tutorials. The new Razor View Engine v2 has a couple of nice features, too, like the new "Tilde Slash" feature that avoids the use of Url.Content and Href to convert relative paths to absolute paths. Another nice feature I want to mention in Razor are conditional attributes, which simplify the code you need to write to include attributes on various HTML tags in your Razor Views. This is a Razor View Engine enhancement and available in ASP.NET MVC 4, ASP.NET Web Pages, and any framework that uses Razor as its templating language.
Razor 2 in ASP.NET MVC 4 has a very subtle enhancement that allows you to dump the old Url.Content("~/...") or @Href("~/...") when specifying relative paths in your Razor Pages and just use "~/". This doesn't seem like much, but it really eliminates a lot of noise in your Razor Views. It also probably cuts down on errors for those in the habit of typing "~/" in their paths anyway forgetting to use Url.Content or something similar.
This is the 3rd post in a series of ASP.NET MVC 4 Tutorials. The first two posts were on ASP.NET MVC 4 Bundling and Minification and ASP.NET MVC 4 Entity Framework and Data Migrations. In this tutorial I want to briefly look at the new Web API integration in ASP.NET MVC 4. Web API introduces a new route for API calls as well as an ApiController that responds to Get, Post, Put, and Delete requests from REST Clients. Web API introduces formatters that can do content negotiation via XML, JSON, etc. as well as provides better customization of the response using HttpResponseMessage.