Urlrewritingnet implements URL rewrite

Source: Internet
Author: User
Tags web hosting

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.