R – ASP.NET URL rewriting not working with folder URLs

asp.neturl-rewriting

I wrote a custom URL rewriting module, to take certain paths and map them to our catalog out of the database.

I am using the technique outlined in the link at the bottom of my post.

I'm using .NET 3.5. The problem is that it only works when there is a page name on the end of the original URL, but if the page name is left off, then it never even calls my handler.
So for example, the URL

http://mysite.com/folder/index.aspx  works but 
http://mysite.com/folder/            does not. 

The one with just the folder never gets into my handler class at all. Is there something you need to do to enable folders to work properly?

http://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/

Best Answer

Is a know issue when using .NET rewriting. You need to correctly configure the wildcard mapping. Here is a good link:

http://devtalk.dk/2007/03/19/Wildcard+Mapping+And+URL+Rewriting+On+IIS7.aspx

Another option will be rewriting by IIS ISAPI with regular expressions. In my company we actually use both.

Check out this link for references:

http://www.kowitz.net/archive/2006/09/15/url-rewriting-using-ihttpmodule-vs-isapi-rewrite.aspx

Related Topic