1.添加UrlRewriter.dll引用
2.修改Web.config
<configSections>节点下添加
<section name="ReplaceUrl" type="URLRewriter.Config.UrlsSection, URLRewriter"/>
根节点下添加
<ReplaceUrl>
<urls>
<add virtualUrl="~/about.html" destinationUrl="~/about.aspx"/>
<add virtualUrl="~/newsItem(.+).html" destinationUrl="~/newsItem.aspx?id=$1"/>
</urls>
</ReplaceUrl>
<httpModules>下添加
<add type="URLRewriter.RewriterModule, URLRewriter" name="RewriterModule"/>
3.调用时比较
newsItem<%=news.Id %>.html
newsItem.aspx?id=<%=news.Id %>