zoukankan      html  css  js  c++  java
  • 微软URLRewriter.dll的url重写在.net简单使用

    最近在做一个cms的网站

    打算做成伪静态,从博客园上差了很多人的资料,终于实验成功了,原理就不讲了,附上在本地的配置,IIS的配置遇到后在发布。

    文章最后附上源码

    步骤如下

    1、新建网站,添加URLRewriter.dll和ActionlessForm.dll

    2、下面配置web.config文件,往<configuration>节点中添加,configSections必须为第一个子元素,否则报错

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

    3、在<configuration>下的<system.web>节点中添加

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

    4、在<configuration>节点下配置Rewriter信息

    </configSections>
      <RewriterConfig>
        <Rules>
          <!-- Rules for Blog Content Displayer -->
            <RewriterRule>
              <LookFor>~/show(d{1,99}).html</LookFor>
              <SendTo>~/show.aspx?id=$1</SendTo>
            </RewriterRule>
          <RewriterRule>
            <LookFor>~/Default.html</LookFor>
            <SendTo>~/Default.aspx</SendTo>
          </RewriterRule>
        </Rules>
      </RewriterConfig>

    基本就完成了。遇到问题会再来修改

    源码下载

  • 相关阅读:
    5285: [Hnoi2018]寻宝游戏
    CF 1117 E. Decypher the String
    4515: [Sdoi2016]游戏
    CF 1051 G. Distinctification
    4820: [Sdoi2017]硬币游戏
    HNOI2019游记
    最近公共祖先(LCT)
    [WC2006]水管局长(LCT)
    P4178 Tree(点分治)
    二维凸包
  • 原文地址:https://www.cnblogs.com/youmeng/p/3673083.html
Copyright © 2011-2022 走看看