MS MVC Preview 2 and .NET 3.5 sp1

I have a site built with MVC Preview 2 and have no way to update it to the latest version, mainly due to the amount of changes needed and didn't have the time. Anyway, my host installed .NET 3.5 sp1 last night and it killed my site. This is an identified issue (this is what you get for using pre beta) on this site http://haacked.com/archive/2008/05/12/sp1-beta-and-its-effect-on-mvc.aspx . and it says to go to this site for work http://www.asp.net/downloads/3.5-SP1/Readme/default.aspx .

Unfortunately the work seems to have been filmed. Can anyone shed some light on what he said and what is going on around.

0


source to share


1 answer


Maybe these instructions are helpful, they should move the site from mvc 2 preview to mvc 3 preview 3. Since 3 site preview does not affect the sp1 beta, I hope this helps:

Updating an Existing Preview2 Application for Preview 3 The information in this section describes the changes you must make to modify an ASP.NET MVC application that was created with Preview 2 to work with Preview 3.

Code Changes Update the links to the following assemblies to point to newer 3 versions of the assembly:

System.Web.Abstractions 
System.Web.Routing 
System.Web.Mvc 

      

By default, these assemblies are located in the following folder:

%ProgramFiles%\Microsoft ASP.NET\ASP.NET MVC Preview 3

      

For all existing action methods, change the return type from void to ActionResult. Anywhere you call RenderView change it to call to return View. You can search RenderView(

and replace it with return View(

.

Anywhere you call RedirectToAction

, add a call with the return keyword. Find RedirectToAction(

and replace it with return RedirectToAction(

.

If you are using a strongly typed page, replace <%= ViewData.PropertyName %>

with <%= ViewData.Model.PropertyName %>

. Instead of replacing the ViewData object with your strongly typed object, the MVC framework now sets the Model property to the instance you provide.

In the Global.asax file, remove the route definition for Default.aspx. In default preview template 2, the route looks like this:

routes.Add(new Route("Default.aspx", new MvcRouteHandler())
{

  Defaults = new RouteValueDictionary(new { controller = "Home", action = "Index", id = "" }),

});

      

In the Global.asax file, find the following MVC default route:

routes.Add(new Route("{controller}/{action}/{id}", new MvcRouteHandler())
{

  Defaults = new RouteValueDictionary(new { action = "Index", id = "" }),

});

      

Replace it with the following route:

routes.MapRoute(
    "Default",                                      // Route name

    "{controller}/{action}/{id}",                   // URL with parameters

    new { controller = "Home", action = "Index", id = "" }  // Parameter defaults

);

      

Add the following line at the very beginning of the RegisterRoutes method:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

      



Edit the Default.aspx file and add the following line:

<% Response.Redirect("~/Home") %> 

      

This redirection is not required for IIS 7. Workaround for the problem with how the Visual Studio built-in web server (ASP.NET Development Server) handles routing.

Configuration Changes In the Web.config file, you must change the httpHandler entry type attribute in the section for UrlRoutingHandler to System.Web.HttpForbiddenHandler.

To do this, search for the following line in the file:

path="UrlRouting.axd" type="System.Web.Routing.UrlRoutingHandler, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 

      

Replace it with the following line:

path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

      

Since the version numbers of the System.Web.Abstractions and System.Web.Routing collections have changed to 0.0.0.0, you must update the version information in the Web.config file. In the Web.config file, find the following line:

System.Web.Routing, Version=3.5.0.0 

      

Replace it with the following line:

System.Web.Routing, Version=0.0.0.0

      

Find the following line:

System.Web.Abstractions, Version=3.5.0.0

      

Replace it with the following line:

System.Web.Abstractions, Version=0.0.0.0

      

+1


source







All Articles