Forum Discussion
Rewrite URI removing file extension
1)
if { [HTTP::host] equals "domain.com" } {
logic here
}
2)
if { [HTTP::path] contains "." } {
logic here
}
3)
This is optional. Forcing a redirect to the URL without the extension has the potential to break functionality, though.
4)
This is where it gets interesting. The best way would probably be to use a sideband connection to check whether the response would be a 404. If it is you can request the resource with the added ".aspx". If the response is anything else you should send it on as the original request.
Normally I'd check for a 200, but there's a slight risk that the app requires certain parameters (or viewstate) and would respond with a 500.
To make matters worse, by default .NET responds to both a server error (500) and Not Found (404) with a 302 (redirect to the appropriate error page, which in turn yields a 200)... Brilliant Microsoft 'logic'!
Unfortunately, I don't have enough time right now to hammer out the code for this part.
5)
HTTP::uri [HTTP::path].aspx
Note: you'd want to add some mechanism to deal with querystrings
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com