I would like to use the ASP.Net URL Rewriting to achieve the following:
My application is physically hosted in the IIS at the following end point: http://www.example.com/someIISApplication/Default.aspx
I want the user to make a request with the following URL and hit the above end point with a querystring parameter like this:
Requested from browser: http://www.example.com/ABC/someIISApplication/Default.aspx
This is how it actually hits the ASP.Net after route processing: http://www.example.com/someIISApplication/Default.aspx?MyParam=ABC
The concept of URL rewriting is simple. When a client sends a request to the Web server for a particular URL, the URL rewriting module analyzes the requested URL and changes it to a different URL on the same server.
URL rewriting is the process of intercepting an incoming Web request and redirecting the request to a different resource. When performing URL rewriting, typically the URL being requested is checked and, based on its value, the request is redirected to a different URL.
You can use URL Rewrite Module for IIS .
Create redirect rule on the site level (www.example.com)
Pattern: ^([_0-9a-z-]+)/someIISApplication/Default.aspx
Redirect URL: someIISApplication/Default.aspx?MyParam={R:1}
For more details see "Creating Rewrite Rules for the URL Rewrite Module"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With