.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:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_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>

 

转载于:https://www.cnblogs.com/sunky/p/9858798.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值