UrlRewriter.NET使用

来源:互联网 发布:centos 7 安装 编辑:程序博客网 时间:2024/06/03 14:52

1:添加引用UrlRewriter.dll

2:修改web配置文件

 

 <configSections>
    <section name="rewriter" 
             requirePermission="false" 
             type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
  </configSections>
 <system.web>
    <httpModules>
      <add name="UrlRewriter" 
           type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
    </httpModules>
  </system.web>
<rewriter>
    <rewrite url="~/Products/(/d+)/Default.aspx" to="~/Products.aspx?PID=$1"/>
  </rewriter>
3:
 string url = string.Format("~/Products/{0}/Default.aspx", "1");
 Response.Redirect(url);

 

原创粉丝点击