1.现在web.config 文件中编写好规则如:
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<RewriterConfig>
<Rules>
<!-- Rules for Blog Content Displayer -->
<RewriterRule>
<LookFor>~/(\d{4})/(\d{2})/(\d{2})\.aspx</LookFor>
<SendTo>~/ShowBlogContent.aspx?year=$1&month=$2&day=$3</SendTo>
</RewriterRule>
<!-- Rules for Product Lister -->
<RewriterRule>
<LookFor>~/ListCategories\.aspx</LookFor>
<SendTo>~/Default.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/([\w]+)*</LookFor>
<SendTo>~/Redirection.aspx?page=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
2.配置站点iis设置如下:
本文介绍如何在ASP.NET应用中配置URL重写规则,通过web.config文件实现友好的URL路径映射,包括日期格式的文章链接、产品列表页面重定向及通用页面转向。
2575

被折叠的 条评论
为什么被折叠?



