‘Tis a day of reconing upon us! The mighty that hath enjoyed the fruits of our labour shall become our lesser kin. ASP.NET#3.5 is being bumped up A WHOLE HALF VERSION! When you’ve regained your breath (have a cup of tea, if it helps) – read on for a breakdown of the glory that shall shine bright in all that is sparky, shiny and new!
First, for me, the major feature has to be something that is already available: ASP.NET MVC – now part of the ‘Out Of The Box’ experience and no longer required to be a separate download (though, still will be for ASP.NET 3.5). This in itself is worthy of a good cold shower, but get this… it’s version 2! Oh yeah, sweetness itself.
MVC 2.0 isn’t actually available as a release version at the moment and is in fact just a preview version. However, well worthy of look if you are at all interested in the original MVC. If you’ve been unable to see the new features in 2.0, then I seriously do not understand how you can sleep at night. In my bid to cure your insomnia, here are a few of the highlights, though, I could go on!
- Areas are being introduced to allow you to easily spread your code apart into logical parts. E.g. You can have an area for your User / Account management stuff, and an area for your Product Listings. This allows you to keep the MVC pattern but in segmented way. Your User Area would have a directory for Controllers, Models and Views, and your Product Area would have separate areas too.
- DataAnnotation Validation is voodoo. A black magic that makes you sit back and go: “WTF, is that it”? It allows you to declare the requirements of a field in a single place within your application, then any time something attempts to update it, the validation must be passed.
- Default Values are easier to declare now.
// something old public ActionResult Browse(string category, [DefaultValue(1)] int page) { } // something new public ActionResult Browse(string category, int page = 1) { }
- They have shortened the attribute [HttpPost] . I know, I saved the best until last!
// out with the old [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(Product product) { } // in with the new! [HttpPost] public ActionResult Create(Product product) { }
As for the rest of ASP.NET 4.0, what can you look forward to? Well!
- The superbly sweet…
<%:productDescription%>
Did you see it? The shorthand response.write alternative which was the equals sign has a rival. But not a dark nemesis with fire-breathing tentacles, nope, a bright white halo-toting angel rival. Simply replace the equal sign with a colon and you have a HTML Encoded Response.Write alternative. Finally, what seems to be a simple solution to reduce considerably, the risk of XSS attacks.
- URL Routing (or of course, URL Rowwting if you are from the US) in much the same way that MVC has it. If you’re familiar with MVC 1, you’ll know the awesomeness that is the friendly URLs that they can produce. With ASP.NET4, this gesture is extended to the general Webforms environment.
- Auto-Starting Web Applications are here! No longer do you need to set up a cron job to make sure that a random visitor doesn’t have to wait for 20 seconds while your application reloads itself into memory. A few tweaks and bliss is yours (and your customers).
- Web.config has been on a diet. It’s shredded almost all of its weight. The only things that need to appear within this now are config settings that you actually want to change from their default. Genius!
1 2 3 4 5 6 7 8 9
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>
- The Entity Framework has become so awesome, it’s skipped a version or two to become EF4.0, and some of the upgrades make it strong and compelling contender for your model structuring! It contains considerably less suck than the first version.
All this ‘win’ makes you nervous? How can the world not implode? That my friend, I do not know – I think it may be like the Y2K Doomsday predictions – its the .NET4 DOOM! Either way, it’s looking good in the ASP.NET world at the moment and I can’t wait for it to land on my desktop!

Coding Horror


