Last post Mar 11, 2010 10:44 AM by Radomir
Feb 09, 2010 06:06 AM|rblaettler|LINK
In order to use ASP.NET Routing I know that in ASP.NET 3.5 I needed to configure the UrlRoutingModule and the UrlRoutingHandler in the web.config file. In all Examples they use the Version for 3.5 too.
I also needed my own IRouteHandler.
Now with ASP.NET 4.0 I don't find any examples on how I have to configure this. Do I still need the entries in the web.config file? If yes, what are they? It sounds like I don't need my own IRouteHandler anymore, since we have MapPageRoute method now.
In any way, I tried all kind of combinations, but nothing seems to do any routing...
Ideas? What did I miss?
Feb 09, 2010 07:52 AM|rblaettler|LINK
Maybe the error message does give some hints:
Detailed Error Information
Module IIS Web Core
Error Code 0x80070002
Requested URL http://localhost:80/supertext/Tuning/All
Physical Path C:\Users\Remy\Documents\Supertext\Supertext_App\Supertext\Tuning\All
Logon Method Anonymous
Logon User Anonymous
Obviously, it's using the wrong request handler. I do use <modules runAllManagedModulesForAllRequests="true">.
Feb 09, 2010 11:59 AM|Radomir|LINK
Routing is built into 4.0, so you do not need to configure those modules any more... It's contained in the System.Web.Routing namespace that is located in the System.Web assembly (system.web.dll)...
Feb 10, 2010 03:16 AM|rblaettler|LINK
Ok, so no configuration.
Any other idea why the StaticFile Handler is processing the Request and not the Routing Module? I even downloaded and installed RoutingExampleCS from
It does create the Links on the Link.aspx page correctly, so the framework is there and work, but the routing still doesn't do anything.
The App runs on an ASP.NET 4.0 Application Pool, but maybe there is still some configuration missing in my IIS?
I use Windows 7 with Visual Studio RC (since yesterday). And I did run aspnet_regiis -i
Feb 10, 2010 04:15 AM|rblaettler|LINK
I just setup the sample project with the option "Filesystem" so it uses the visual studio webserver instead of IIS and it works! So I'm pretty sure the issue is somewhere with the IIS configuration. Just what is missing?
Feb 10, 2010 09:08 AM|rblaettler|LINK
I figured it out.
One has to enable the HTTP Redirection Feature under
Windows Features -> Internet Information Services -> Word Wide Web services -> Common HTTP Features
Maybe also enable to HTTP Errors (I read that somewhere).
Mar 10, 2010 10:46 AM|matt88|LINK
I'm having this same issue it runs great on my local under casini and IIS 7.5(win7) but when I deployed my app out to my staging servers iis7 and iis7.5 nothing worked I only got 404 responses. I was only able to get it to work when I added <modules runAllManagedModulesForAllRequests="true">
to the web.config file.
Does anyone have a clue why? Everything that Im reading says with 4.0 no config file changes were needed.
Mar 11, 2010 10:44 AM|Radomir|LINK
UrlRoutingModule is set up in the <modules> section and is declared with the pre-condition of managedHandler. In other words, it will be invoked only if the handler for the request is managed. In the default setup, the StaticFile handler mapping is the
"catchall" and is not mapped to any managed handlers.. therefore, routing module isn't getting invoked. By putting that config setting, you're forcing IIS to invoke all modules, just as the name says.
Of course, another option would be to remove the managedHandler precondition, but I'd prefer the web.config setting to that (it gives you a more granular control over this behavior)