• 在ASP.Net2.0中使用UrlRewritingNet实现链接重写


    采用UrlRewritingNet.UrlRewriter.dll来轻松实现
    UrlRewritingNet.UrlRewriter.dll 可从其官方网站下载:
    http://www.urlrewriting.net


    0 设置之前需要添加引用:UrlRewritingNet.UrlRewriter.dll
    1 <configSections>间添加:
      <configSections>
      <section name="urlrewritingnet" restartOnExternalChanges="true" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
    </configSections>
    2   添加httpModules
      <httpModules>
          <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
      </httpModules>

      <system.webServer>

    <modules>
              <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/> <!--lzx add-->
        </modules>

      <system.webServer>


    3 添加链接重写的设置  <configuration> 节点下任一地方
    <urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
      <rewrites>
       <add name="Rewrite1" virtualUrl="^http://(.*)/UrlRewritingTest/test.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/default.aspx" rewrite="Domain" ignoreCase="true"/>
       <add name="Rewrite2" virtualUrl="^http://(.*)/UrlRewritingTest/test1.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/info.aspx?year=2007&amp;month=3&amp;day=9" rewrite="Domain" ignoreCase="true"/>
      </rewrites>
    </urlrewritingnet>

    web.config  文件 如:

    <?xml version="1.0"?>
    <configuration>
       
    <configSections>
           
    <section name="urlrewritingnet" restartOnExternalChanges="true" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
       
    </configSections>
       
    <urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
           
    <rewrites>
               
    <add name="Rewrite1" virtualUrl="^http://(.*)/UrlRewritingTest/test.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/default.aspx" rewrite="Domain" ignoreCase="true"/>
               
    <add name="Rewrite2" virtualUrl="^http://(.*)/UrlRewritingTest/test1.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/info.aspx?year=2007&amp;month=3&amp;day=9" rewrite="Domain" ignoreCase="true"/>
               
    <add name="Rewrite3" virtualUrl="^http://(.*)/UrlRewritingTest/test(d{4})(d{2})(d{2}).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/info.aspx?year=$2&amp;month=$3&amp;day=$4" rewrite="Domain" ignoreCase="true"/>
               
    <add name="Rewrite4" virtualUrl="^http://(.*)/UrlRewritingTest/(d{4})/(d{2})/(d{2})/info.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/info.aspx?year=$2&amp;month=$3&amp;day=$4" rewrite="Domain" ignoreCase="true"/>
         
    <add name="Rewrite5" virtualUrl="^http://(.*)/UrlRewritingTest/stock(d{6}).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/stockinfo.aspx?code=$2" rewrite="Domain" ignoreCase="true"/>
           
    </rewrites>
       
    </urlrewritingnet>
       
    <appSettings/>
       
    <system.web>
           
    <httpModules>
               
    <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
           
    </httpModules>
           
    <compilation debug="true"/>
     
    </system.web>

     <system.webServer>

    <modules>

              <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/> <!--lzx add-->     </modules>

      <system.webServer>


    </configuration>

  • 相关阅读:
    Ctfshow Web入门
    Java复习笔记
    Saliency-Guided Attention Network for Image-Sentence Matching
    根据CSV文件生成ImageFolder格式数据集,并按比例划分训练集验证集
    Context-Aware Multi-View Summarization Network for Image-Text Matching
    Classes Matter: A Fine-grained Adversarial Approach to Cross-domain Semantic Segmentation
    GINet: Graph Interaction Network for Scene Parsing
    Neural Multimodal Cooperative Learning Toward Micro-Video Understanding
    GAN&cGAN&DCGAN
    循环神经网络
  • 原文地址:https://www.cnblogs.com/hellen-li/p/3280806.html
Copyright © 2020-2023  润新知