解决查询字符串过长的问题
不同页面传值遇到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>
- 如果查询字符串长度已经配置到最大,还是超长,可以通过页面缓存来实现取值
- cookie
- localStorage
- caches
- application cache
- indexedDB
- sessionStorage
以上方式的用法请网上自行查询。