好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

IIS7 下使用微软URLreWrite

1、添加引用ActionlessForm.dll和URLRewriter.dll

2、configuration节点下的configSections加点下加下面配置

  <configSections>

    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>   

    </configSections>

3、configuration节点下添加如下配置(配置的规则)

  <RewriterConfig>

    <Rules>

      <RewriterRule>

        <LookFor>~/Index</LookFor>

        <SendTo>~/Default.aspx</SendTo>

      </RewriterRule>

    </Rules>

  </RewriterConfig>

4、system.web节点下添加如下节点

<httpHandlers>

        <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />

</httpHandlers>

<httpModules>

        <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>

</httpModules>

5、IIS7 一般报404错误关键在于system.webServer节点的modules节点下添加如下配置(关键)

<modules>

        <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>

</modules>

查看更多关于IIS7 下使用微软URLreWrite的详细内容...

  阅读:9664次