Implement URL rewrite in Asp.net. In addition to the URL rewrite module in IIS, there are also other solutions, such as urlrewritingnet.
Urlrewritingnet claims that all operations except file extension rewrite require IIS support do not require IIS settings, which of course is very convenient for web hosting websites.
The following describes how to deploy urlrewritingnet:
1. First place the downloaded DLL to the bin directory
2. modify web. config and add the urlrewritingnet configuration as follows:
Requirepermission = "false"
Type = "urlrewritingnet. configuration. urlrewritesection, urlrewritingnet. urlrewriter"/>
Contextitemsprefix = "querystring"
Defaultprovider = "RegEx"
Xmlns = "http://www.urlrewriting.net/schemas/config/2006/07">
Virtualurl = "^ ~ /Category /(.*)"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Index.html? Category = $1"
Redirect = "application"
Ignorecase = "true"/>
Virtualurl = "^ ~ /Book/(. *), index. xml"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Reader.html? Book = $1"
Redirect = "application"
Ignorecase = "true"/>
Virtualurl = "^ ~ /API/category /(.*)"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /API/category. ashx? Path = $1"
Ignorecase = "true"/>
Virtualurl = "^ ~ /API/book /(.*)"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /API/book. ashx? Path = $1"
Ignorecase = "true"/>
Virtualurl = "^ ~ /API/META /(.*)"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /API/meta. ashx? Path = $1"
Ignorecase = "true"/>
3. Embed Rewrite Rules in . Virtualurl is the virtual URL of the regular expression, and destinationurl is the target URL. If redirect is specified, urlrewritingnet will be relocated through HTTP 301,302, and the Web site displayed in the browser will change.
4. Note that you need to add global. asax and urlrewritingnet to take effect.