ASP.NET MVC 2 Preview 2 Released

Posted by Matthew Osborn on October 1, 2009

I am proud to announce that ASP.NET MVC 2 Preview 2 has been released! So what are you waiting for? Go download it, its okay I’ll wait here… If you are running MVC 1.0 the good news is that just like Preview 1, Preview 2 can live side by side with it. However, as with previous preview releases, it is recommended that you uninstall Preview 1 prior to installing Preview 2. Currently there is no glamorous way of converting a MVC 1.0 project to a MVC 2 project but it is a pretty simple process and instructions can be found in the released notes.

Okay now for some more interesting stuff, the new features that are in Preview 2. If you missed Preview 1 you can read Phil’s post to see what was in that release.

  • Single-Project Areas: For those of you familiar with Multi-Project Areas from Preview one this should be a span. If not, an area is simply a way of segregating logical units of  your application. For instance, think of segmenting the blog and store in a company website. The difference now is that this can all be done inside of a single project file.
  • Client Side Validation: Client side validation was something that the ASP.NET MVC framework was missing, well not anymore. Basically out of the box we support the ability to have nice client side validation when you annotate your model objects use Data Annotations. However, this is completely extensible and you can create your providers both for client side and server side validation.
  • ModelMetaData: As MVC 2 started to grow in its feature set it became apparent that the ability to easily access metadata about the model was very important. So after a few rubs on the oil lamp and a chat with a genie, poof we now have and object call ModelMetaData that hangs off of the ViewDataDictionary. Just like client validation this is completely extensible and you have the ability to create your own provider. Out of the box we have built in functionality for Data Annotations.
  • HTTP Verb Overrides: Anyone that has worked with ASP.NET MVC for any amount of time is familiar with HTTP Verbs. Basically a HTTP Verb is a value passed to the server such as GET or POST that tell the server what the client is trying to do. However, there are several lesser known verbs like PUT and DELETE, because quite simply most browser can only use three verbs, HEAD, GET, and POST. This is not true anymore! Well at least for ASP.NET MVC 2 that is. We know allow you to override the POST verb with any of the others. Along with that we have also create some nice shortcut attributes to use when marking actions in your controller just like the HttpPost one in Preview 1.
  • Tons of Other Stuff: To try to keep this post some what short I decide to wrap some of the smaller items into one bullet point as it would take a long time to explain them all. The short of it is that there is lots of cool features, bug fixes, and some API changes in Preview 2. Some of the notable ones are new code snippets, additional default templated helpers, and a new attribute to mark an action as needing HTTPS.

So please go download it, try it out, and give us your feedback! After all that is the whole idea of releasing these previews. Also I would like to give a big thanks to everyone on the team that helped to make this a successful release!