And Getting ASP.NET Routing Up and Running in Web Applications and on IIS7

Just a quick follow-up to my previous post. To get routing working in a web application project you can follow exactly the same steps for the website in my previous post. I also deployed my website to IIS7 running in the default app pool. To do this you need to make a couple of changes to the <system.webServer> section in web.config.

In the <modules> section add:

 <remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule"
     type="System.Web.Routing.UrlRoutingModule, 
    System.Web.Routing, Version=3.5.0.0, 
    Culture=neutral, 
    PublicKeyToken=31BF3856AD364E35"/>

and in the <handlers> section add:

 <add name="UrlRoutingHandler"
     preCondition="integratedMode"
     verb="*"
     path="UrlRouting.axd"
     type="System.Web.HttpForbiddenHandler, 
         System.Web, Version=2.0.0.0, 
         Culture=neutral, 
         PublicKeyToken=b03f5f7f11d50a3a" />

There is a comprehensive MSDN article on this including the changes required to host in both IIS6 and IIS7.

Technorati Tags: asp.networking,routing,iis