查询字符串过长

不同页面传值遇到Web服务器上的请求筛选被配置为拒绝该请求,因为查询字符串过长

  • 确认 applicationhost.config 或 web.config 文件中的 configuration/system.webServer/security/requestFiltering/restLimits@maxQueryString 设置.

解决方法

在 web.config 中配置查询字符串长度
最大长度为 2097151

<configuration>
  <system.web>
    <httpRuntime  maxQueryStringLength="2097151"/>
  </system.web>
</configuration>
<configuration>
  <system.webServer>
	<security>
      <requestFiltering>
        <requestLimits maxQueryString="2147483647"/>
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>
  • 如果查询字符串长度已经配置到最大,还是超长,可以通过页面缓存来实现取值
  1. cookie
  2. localStorage
  3. caches
  4. application cache
  5. indexedDB
  6. sessionStorage

以上方式的用法请网上自行查询。


版权声明:本文为InJra_p原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。