• 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

  • 相关阅读:
    css文字两端对齐,而且居中
    vue项目做微信分享总结
    js获取url参数
    vue微信支付遇到的坑
    Win7的环境变量下的系统变量path不小心修改了,怎么恢复
    解决ios上滑动不流畅及滚动条隐藏无效问题
    数组更新检测
    列表渲染
    条件渲染
    vue调试工具的安装
  • 原文地址:https://www.cnblogs.com/seerlin/p/1598694.html
Copyright © 2020-2023  润新知