Step One: Add a reference and Formrewritercontroladapter assembly reference to the Urlrewriter assembly in the Web site project.
Note: If you have pagination in your project, you need to add a "formrewritercontroladapter" assembly reference, otherwise you do not need to add the reference.
Download address: http://www.net.cn/service/ziliao/cpsc/200906/3842.html (million network/help Center (m enjoy host urlrewrite components and manuals))
Step Two: Configure the Webconfig file :
Note:1, the parameters are enclosed in (), using $ to get parameters. 2, multiple parameters of the time using & segmentation.
1, in the <configuration> and </configuration> node to add the following configuration:
Copy Code code as follows:
<configSections>
<section name= "Rewriterconfig" type= "URLRewriter.Config.RewriterConfigSerializerSectionHandler, Urlrewriter"/ >
</configSections>
2, between <system.web> and </system.web> to join
Copy Code code as follows:
<add verb= "*" path= "*.aspx" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
<add verb= "*" path= "*.html" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
Or
Copy Code code as follows:
<system.web>
<add type= "Urlrewriter.modulerewriter, Urlrewriter" name= "Modulerewriter"/>
</system.web>
3. Configure pseudo static syntax: Add <RewriterConfig> </RewriterConfig> node between <configuration> and </configuration>.
To add a pseudo static rule between <RewriterConfig> and </RewriterConfig>:
<Rules> <!– defines pseudo static first rule start –> <RewriterRule> <lookfor>~/xxxx/view (. [ \d]*) \.html</lookfor> <SendTo>~/xxxx/view.aspx?id=$1</SendTo> </RewriterRule>
<!– defines pseudo static first rule end –> <!– define pseudo static second rule start –> <RewriterRule> <lookfor>~/yyyy/(. [ \d]*)/view.html</lookfor> <SendTo>~/yyyy/view.aspx?id=$1</SendTo> </RewriterRule>
Examples such as:
Copy Code code as follows:
<RewriterConfig>
<Rules>
<!--official website-->
<RewriterRule>
<lookfor>~/web/new/type-(. [ 0-9]*) \.html</lookfor>
<SendTo>~/web/new.aspx?id=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>/index.html</LookFor>
<SendTo>/index.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<lookfor>/aboutus/aboutuscontent-(. *) .html</lookfor>
<SendTo>/aboutus/aboutusContent.aspx?pageurl=$1</SendTo>
</RewriterRule>
<RewriterRule>
<lookfor>/shop/giftlist-(. *)-(. *) .html</lookfor>
<SendTo>/shop/GiftList.aspx?nav=$1&price=$2</SendTo>
</RewriterRule>
<RewriterRule>
<lookfor>/shop/list-(. *)-(. *)-(. *) .html</lookfor>
<SendTo>/shop/list.aspx?nav=$1&licno=$2&orderby=$3</SendTo>
</RewriterRule>
<RewriterRule>
<lookfor>/shop/list-(. *)-(. *)-(. *)-(. *) .html</lookfor>
<SendTo>/shop/list.aspx?nav=$1&licno=$2&orderby=$3&price=$4</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
Or
Copy Code code as follows:
<RewriterConfig>
<rewriter>
<rewrite url= "^ (/.+ (\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js). +)?) $ "to=" processing= "Stop"/>
<rewrite url= "~/lmh$" to= "~/USERS.ASPX?USER=LMH" processing= "Stop"/>
<rewrite url= "~/tags/(. +)" to= "~/tag/tagcloud.aspx?tag=$1" processing= "Stop"/> <rewrite url= "^~/mypage" (\?). +)? $ "to=" ~/index.htm$1 "processing=" Stop "/> <rewrite url=" ~/article-([^-]+)-([^-]+)-([^-]+). html "to=" ~/ Testurl/article.asp?id=$1&sid=$2&page=$3 "processing=" Stop "/>
<rewrite url= "^ (. *)/(\?. +)? $ "to=" $1/index.htm$2?/>
</rewritr>
</RewriterConfig>
A URL is a regular expression that can be used. Like the example above:
Rule one: When the discovery file type is. gif,. png,.jpg,. ico,. pdf,. css or. js, stop rewrite
Rule two: is to rewrite/LMH to/users.aspx?user=lmh,$ in the regular expression is the end of the string, that is to say/lmhe will not be rewritten to the address after, if the $ remove can be
Rule three: Rewrite tags/xxx to tag/tagcloud.aspx? Tag=xxx
Rule four: Go to the Site default page when the user enters an error like an address in mypagexxx form
Rule five: Set the default page for a user's web site to index.htm
New Add ASP rule: Convert article.asp?id=13&sid=10&page=2 through pseudo static to article-10-13-2.html format to access page
Step Three: Configure IIS6.0
1, right click to set the site site
2, Attributes-"The main directory-" configuration-"
3, such as the right window, find the. aspx extension--edit--Copy executable path--close
4, click Add--"Paste just copied executable file path
5. Fill in the extension. html (if it is. htm or any extension you want it can be provided that there is no extension in the Future Application Extensions list)
6, do not select the confirmation file exists
7, determine