Actually the URL rewrite with .NET 2.0 is crap. They didn't build in a full baked solution because IIS 7 is going to have URL rewrite capability natively - and all I can say is it's about time. Essentially, the .NET 2.0 rewrite is useless unless you have a specific static page you want to redirect to, and you can easily do that with a 301. There is no support for Regular Expressions making any reasonable solution impossible.
For now I'm using
http://www.isapirewrite.com/ with excellent results
I was using the free
http://www.iismods.com/url-rewrite/index.htm, but it was crashing the live server for some reason. I use it on other sites with lots of luck so I'm not sure what the issue is.
Basically, all my pages are dynamically created from a database using a single page Content.aspx Then I pass in a "friendly" URL to keep the URLs pretty. To the backend ASP.NET site the requests look like:
/Content.aspx?friendy=Page_Name
but to the end user it looks like:
/en/Page_Name.html
The rewrite is pretty simple:
Code:
RewriteRule .*/en\/(.*)\.html\?(.*) /Content.aspx?friendly=$1&$2 [L]
RewriteRule .*/en\/(.*)\.html /Content.aspx?friendly=$1 [L]
You need the first one in case there are parameters passed. I think I only do on one page so I could make it more hardcoded than that, but why not plan for flexibility.
I'll try to get some better code examples up later.