ASP.NET MVC 3 Preview 1 Source code

Microsoft has uploaded the source code for MVC 3 Preview 1. You can download the source code from below
http://www.microsoft.com/downloads/details.aspx?FamilyID=cb42f741-8fb1-4f43-a5fa-812096f8d1e8&displaylang=en

You can download the preview 1 from below link
http://www.microsoft.com/downloads/details.aspx?FamilyID=cb42f741-8fb1-4f43-a5fa-812096f8d1e8&displaylang=en

There are some useful features (considered to be included in MVC 3) is now available in MVC Preview 1.
Some of the features in preview 3 features are below

  • New ActionResults
  • New Razor View Engine
  • HttpNotFoundResult, HttpRedirectResult with support for Permanent Redirects, and HttpStatusCodeResult.
  • Global Filters
  • Model Binding to JSON
  • Validation – .NET 4 introduced IValidatableObject and improvements on ValidationAttribute to provide even better validation and ASP.NET MVC 3 will offer better support for them.
  • Dependency Injection and Common Service Locator Enhancements

You can find more information
http://weblogs.asp.net/scottgu/archive/2008/05/27/asp-net-mvc-preview-3-release.aspx

http://haacked.com/archive/2010/07/27/aspnetmvc3-preview1-released.aspx
It is very early stage so there are no guarantees that all these features will be included in the final release.

URL Routing in ASP.NET 4.0

In ASP.NET MVC you can have clean nice SEO friendly Url.

routing1

For example:

However with ASP.NET 3.5 SP1, Webforms require an implementation of an IRouteHandler to support clean nice Url. This can be quite tedious, and often require more work.  With ASP.NET 4.0, you can add this support easily without having to use or implement an IRouteHandler.

The below two articles explain how to achieve this in web forms.

Converting your MVC1 project to MVC2 in VS2008

You may have confronted with a task to convert a MVC1 project to MVC2. The article from Eilon Lipton’s Blog describes a really nice tool that allows you to do it. You can run this tool and convert most of MVC 1 apps. If the conversion is unsuccessful, the other option is to do it manually. It is very easy. As MVC upgrade notes explains, below are the steps.

Manually Upgrading an ASP.NET MVC 1.0 Project

To manually upgrade an existing ASP.NET MVC 1.0 application to version 2, follow these steps:

  1. Make a backup of the existing project.
  1. In a text editor, open the project file (the file with the .csproj or .vbproj file extension) and find the ProjectTypeGuid element. As the value of that element, replace the GUID {603c0e0b-db56-11dc-be95-000d561079b0} with {F85E285D-A4E0-4152-9332-AB1D724D3325}. When you are done, the value of that element should be as follows:{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
  1. In the Web application root folder, edit the Web.config file. Search for System.Web.Mvc, Version=1.0.0.0 and replace all instances with System.Web.Mvc, Version=2.0.0.0.
  1. Repeat the previous step for the Web.config file located in the Views folder.
  1. Open the project using Visual Studio, and in Solution Explorer, expand theReferences node. Delete the reference to System.Web.Mvc (which points to the version 1.0 assembly). Add a reference to System.Web.Mvc (v2.0.0.0).
  1. Add the following bindingRedirect element to the Web.config file in the application root under the configuration section.
  1. Create a new empty ASP.NET MVC 2 application. Copy the files from the Scripts folder of the new application into the Scripts folder of the existing application.
  1. Update the existing application’s CSS file with the CSS style definitions in the Site.css file.
  1. Compile the application and run it. If any errors occur, refer to the Breaking Changes section of the What’s New in ASP.NET MVC 2 page.

 

Step 6 explains that if your project has reference MVC 1, you can still run it with MVC2 application. So the old version (1.0.0.0) will bind to new version 2.0.0.0. Step 7 and Step 8 may be optional. For example you might not want to update your existing styles in CSS. You may not have script folder instead you may have a CDN setup to deliver your scripts. In those cases simply ignore these steps.