的URL重写不需要在IIS上安装任何控件,微软有一个叫做Mircosoft URLRewriter.dll的.NET组件,用这个组件在中引用后修改Web.config增加规则即可,详细参考
http://
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="urlrewritingnet" requirePermission ="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
</configSections>
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage = "default.aspx" defaultProvider="RegEx" xmlns="http://www. >
<rewrites>
<!--这里是正则表达式规则添加的地方-->
<!--virtualUrl代表虚拟的静态路径destinationUrl真实路径-->
<add name="Rewrite" virtualUrl="^~/(.*)/Detail(.*).htm"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Default.aspx?type=$1&id=$2"
ignoreCase="true" />
</rewrites>
</urlrewritingnet>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true"/>
<authentication mode="Windows"/>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
</configuration
http://
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="urlrewritingnet" requirePermission ="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
</configSections>
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage = "default.aspx" defaultProvider="RegEx" xmlns="http://www. >
<rewrites>
<!--这里是正则表达式规则添加的地方-->
<!--virtualUrl代表虚拟的静态路径destinationUrl真实路径-->
<add name="Rewrite" virtualUrl="^~/(.*)/Detail(.*).htm"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Default.aspx?type=$1&id=$2"
ignoreCase="true" />
</rewrites>
</urlrewritingnet>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true"/>
<authentication mode="Windows"/>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
</configuration