UrlReWriter 在web.config中简单的配置

1.配置的第一个节点

<configSections>
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,Intelligencia.UrlRewriter"/>
</configSections>

2.配置的第二个节点

<httpModules>    
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" />
</httpModules>

3.配置的第三个节点(ASP.NET4.0才需要)

<system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
          <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>
    </modules>
</system.webServer>    

4.编写规则

  <rewriter>
    <rewrite url="~/about.html" to="~/Default.aspx" processing="stop" />
    <rewrite url="^.*-d([0-9]+)/?$" to="~/Default.aspx?ID=$1" processing="stop" />
  </rewriter>

这规则主在<configSections>后面

5.设置IIS

网站——属性——主目录——配置——在通配符应用程序映射中点插入——在可执行文件中,浏览(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll)当你的网站是.Net2.0的,

posted @ 2012-11-05 11:47  刘继先  阅读(797)  评论(1编辑  收藏  举报