I really like the new .NET 4 (3.5) routing, it is very simple and straight forward to implement – just add some MapPageRoute to your global.asax and then some RouteData.Values to your aspx files 🙂
Anyway it was simple until last night when I was adding routing to an old VB.NET WebSite project. I just could not get it to work, I kept getting HTTP 404 errors:
Error Summary
HTTP Error 404.0 – Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Finally I figured out that I had some stuff missing in my web.config to get this to work, ie making sure the routing module runs.
[code]
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
[/code]
or use this:
[code]
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
[/code]
This is probably not a problem for new projects created in Visual Studio 2010 but obviously my old web.config needed some fixing.
Thanks to this blog post by Ashic Mahtab.
thnx