• .Net Intelligencia.UrlRewriter 重定向参数中文支持配置方法


    在使用.Net 官方 Url重定向组件时,发现若原地址包含中文,如:http://localhost/首页.html 重定向为:http://localhost/index.aspx?id=首页  时,接收的中文参数为乱码,使用各种方法解决无果,发现一博友的解决方法有效:

    https://www.cnblogs.com/simoncai/p/5711700.html

    使用环境为:iis7+.net4.0。

    解决完成后,重新配置IIS又花费了些时间,记录一下全部Web.config内容:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    
    <configuration>
      <configSections>
        <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
      </configSections>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <httpModules>
          <add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter" />
        </httpModules>
      </system.web>
    
      <system.webServer>
        <!--解决集成通道无法使用问题-->
        <validation validateIntegratedModeConfiguration="false" />
        <defaultDocument>
          <files>
            <add value="index.aspx" />
          </files>
        </defaultDocument>
        <handlers>
        <!--添加html脚本映射--> <add name="rewriter" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32" /> </handlers> </system.webServer> <rewriter> <!--重写规则--> <rewrite url="^/(d+).aspx$" to="~/index.aspx?id=$1" processing="stop" /> <rewrite url="^/(.+).html$" to="~/index.aspx?id=$1"/> </rewriter> </configuration>
  • 相关阅读:
    UML简单熟悉
    Java设计模式--单例模式
    MyEclipse2014安装图解
    让Win10显示系统中隐藏的文件夹
    Ping命令
    C语言学习
    技术学习论坛地址收集
    聊聊JVM的年轻代(转)
    深入理解JVM--JVM垃圾回收机制(转)
    JVM调优浅谈(转)
  • 原文地址:https://www.cnblogs.com/sunky/p/9858798.html
Copyright © 2020-2023  润新知