Was working on an ASP.NET website this past week that got flipped over to ASP.NET 4.0 without the team really being aware of the change. A very apparent bug popped up, where a http module we had running on every request (for security purposes), had the current identity user coming back as NULL only on specific URL’s. With some testing and debugging, we found those URL’s to be directories when the module would fail. After finding that I immediately thought about how the .NET 4.0 URL Routing feature might be affected by this?
It turns out that modules are not loaded on every request. In this instance the Membership module needed to be loaded. Essentially the solution is to manually add the required module in our web.config and removing the entry (with a remove statement) from the inherited entries. Be sure to set the precondition=””.
I know I have explained this all very poorly, but you get the gist. Check out this article on routing in IIS7 for all the details!