简体   繁体   中英

Asp.net URL Rewriting

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM