default.aspx.cs:
protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("product/item=33"); } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("Registration"); }
点击商品 URL:http://localhost:3052/WebSite1/product/item=33
点击注册 URL:http://localhost:3052/WebSite1/Registration
1
2
3
4
5
6
7
8
9
|
<
configuration
>
<
configSections
>
<
section
name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission ="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection,
UrlRewritingNet.UrlRewriter" />
</
configSections
>
</
configuration
>
|
1
2
3
4
5
6
|
<
system.web
>
<
httpModules
>
<
add
name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</
httpModules
>
</
system.web
>
|
1
2
3
4
5
6
|
<
urlrewritingnet
rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<
rewrites
>
<
add
name="RewriteOnDomain" virtualUrl="^http\://(.*)/product/item=(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/ProductDetails.aspx?productCode=$2" rewrite="Domain" ignoreCase="true"/>
<
add
name="Rewrite" virtualUrl="^http\://(.*)/Registration" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Registion.aspx" rewrite="Domain" ignoreCase="true"/>
</
rewrites
>
</
urlrewritingnet
>
|
本文转自曾祥展博客园博客,原文链接:http://www.cnblogs.com/zengxiangzhan/archive/2010/01/07/1641089.html
,如需转载请自行联系原作者