Blog      Products      DotNetWiki      Support      Contact  
     Blog Categories
 - All
 - .NET
 - 4 Word Book Reviews
 - AllPodcasts
 - Business Thoughts
 - Clueless Idiocy
 - Norn Iron
 - Personal
 - Podcasting
 - PowerPack
 - Weird Interweb Stuff
 
     Geoff on Twitter
 
     Local Blogs
 
  ASP.NET PowerPack
The ASP.NET PowerPack contains 28 rich, cross-browser controls including:
 - RichTextBox
 - ComboBox
 - DatePicker
 - No-Repost validator

Try the ASP.NET PowerPack free today!
 - More Info
 - Download
 - Price List
 - Licensing
 - Buy Now!

 
     Web Tools
 - The DotNetWiki
 - OPML Viewer
 - RSS Viewer
 - ASP.NET Colors
 - Base64 Encode
 - Base64 Decode
 - HTML Encode
 - HTML Decode
 - URL Encode
 - URL Decode
 - Crazy IPs
 - Whois

 
     Windows Tools

ADO.NET ConnTest
A simple, free Windows program to test ADO.NET connection strings.

Lines of C#
Ever wanted to know how many lines of C# code are in a file or folder hierarchy?  This free Windows program will tell you.

XmlTools
Free tools to process XML files from the command line.

 
IIS6 wildcard redirection is confusing

There really is a dearth of documentation on IIS6's wildcard redirection.

It seemed simple - I was renaming the Blog.aspx page in my blog to BlogEntry.aspx (no, don't ask why) and I wanted all the requests for the old page to go to the new one.

Similarly, I wanted requests for the Rss2.aspx page to go to the Rss.aspx page.  (Don't ask about this either.)

Except IIS's wildcards don't work the way you expect, and the expected redirection rules led to either:

  1. No rewriting,
  2. Incorrect rewriting, or
  3. Really, really incorrect rewriting that kept rewriting until the URL was too long for it to deal with.

So, a frustrating half-hour later, after trying every interpretation of the two documents Microsoft provides I could think of, I've come up with a rewriting rule that works.

And I'm going to share it with you now.

Remember, this is a fairly trivial thing to redirect (confused a little by the way my blog puts querystring parameters in the path, I admit).  And yet this is the most complex example of IIS URL rewriting I've seen.  The examples in the documentation and the ones I've found elsewhere are much more trivial (something I didn't think would be possible).

Are you ready?  Here goes:

*;/*Rss2.aspx;/Blog/Rss.aspx;/*/Blog.aspx;/Blog/$0/BlogEntry.aspx

That does the trick, for me at least.  I really figured something like:

*;Rss2.aspx;Rss.aspx;*/Blog.aspx;$0/BlogEntry.aspx

would have worked...



Categories: .NET
Permalink #.Posted by 'geoff' on Thursday, 03 April 2008 at 5:49PM


Comments, Trackbacks and Pingbacks

There are no comments to display.

Post A Comment

Your Name:
Your URL (optional):
Comment Title:


View my Technorati Profile.
RSS 2.0 Subscribe to the RSS 2.0 feed for Geoff's Blog.