zoukankan      html  css  js  c++  java
  • UrlRewriter.net简单例子

     UrlRewriter.net的使用方法
        1,将Intelligencia.UrlRewriter.dll这个文件放到项目的bin目录下,然后添加对它的引用
        2,打开web.config这个文件,添加如下配置
            2.1 添加handler配置:
           <configSections>
      <section
       name="rewriter"
       type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
     </configSections>
         2.2 添加modul配置
         <system.web>
      <httpModules>
       <add
        type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"
        name="UrlRewriter" />
      </httpModules>
     </system.web>
     
     
     3,添加你要重写的url规则:
         <rewriter>  
             --用正则表达式匹配url路径,然后跳到你想要的真实路径
                <rewrite url="^/admin/user/(\w{6,12})$" to="/admin/UserManager.aspx?UserName=$1" />--用户名只能是6到12位的字符
                <rewrite url="^/admin/product/(\d.+)$" to="/admin/ProductManager.aspx?Id=$1" />   --产品id只能是数字
            </rewriter>
           
        4,测试:

      在附件可以下载我的例子
            输入:http://localhost:6642/admin/user/linzhenchong成功
            输入:http://localhost:6642/admin/user/lzc失败

    附件:/Files/Allnen/UrlRewriterTest_2009-11-8.7z

  • 相关阅读:
    HTML5和HTML4之间的区别
    HttpRequest信息内容介绍
    Spring Web MVC处理请求的流程
    游戏中的路径动画设计与实现
    Python基本数据类型
    Python基本数据类型
    perl .= 操作符
    出差二、三事——北漂18年(25)
    perl 卸载Oracle数据库
    perl 卸载mysql数据库
  • 原文地址:https://www.cnblogs.com/seerlin/p/1598694.html
Copyright © 2011-2022 走看看