Directories to parameters with IIS 6 and wildcard redirection
Some parameters have been changed to protect the innocent.
This could be old news, and since I'm talking about IIS 6, I know it is. But, I just discovered the other day how to pass parameters to a file using IIS 6, a virtual directory, and a URL that contains directories below the virtual directory.
So, at work I had a horrible URL like the following (ignore the invalid space):
What I wanted to do was allow someone to use a URL like this to get to that page:
- or -
Luckily, after a lucky Google search, I found a Microsoft TechNet on this very issue, in the Server 2003 Redirect Reference (IIS 6.0).
The solution was to create a virtual directory called enews, and configure it to redirect to the exact URL entered:
;////; /filename.cfm?parameterA=valueA¶meterB=valueB&issuemonth=$2&issueyear=$1&groupname=$0;///*; /filename.cfm?parameterA=valueA¶meterB=valueB&issuemonth=$2&issueyear=$1&groupname=$0
Basically the second and third, semi-colon-delimited, strings handle the first URL (trailing slash) while the fourth and fifth handle the second.
One thing that isn't covered is if they don't pass a 'month'. However, I'd assume that an additional 'block' could be setup to handle this, as well as the case where there's only a group name.
The disappointing thing is that this doesn't allow for too much in the way of wildcards - you can manually add text, or use a * for a wildcard - nothing fancy with switches or anything. But … that's okay.
The TechNet article covers a number of other things, so … definitely give it a look.
The more I use Microsoft products, the more impressed I am with the resources they make available online.
- Review: Empires of EVE: A History of the Great Wars of EVE Online
- Review: Ghost in the Shell README: 1995-2017
- Review: Fitbit Charge 2 Bands,Fitbit Bands Milanese Loop Stainless Steel Metal Replacement Bracelet Strap, Wristbands Accessories for Charge 2 with Stronger Magnetic Clasp
- Review: Wickedly Prime Organic Roasted Seaweed Snacks, Korean Kalbi
- Review: 5-Minute Dungeon
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.