URLRewriter组件实现伪静态

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 %>

 

posted @ 2013-05-24 17:49  Xyang  阅读(327)  评论(0编辑  收藏  举报
hi