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: JLHua Silicone Multi-Use Cartoon Cat Trivet Mat (set of 6 Pack) Insulated Flexible Durable Non Slip Hot Pads and Coasters Cup Mats
- Review: Tash-Kalar: Arena of Legends
- Review: Babymoov Dream Belt – Maternity Sleep Support & Cushion for Ultimate Comfort during Pregnancy
- Review: AmazonBasics PlayStation 4 Controller Charging Cable
- Review: Galaxy Trucker
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.