我正在构建一个网站,我想在其中根据 textarea 元素的值创建一个文件客户端。
我有执行此操作的代码,但我收到此错误
HTTP Error 404.15 - Not Found The request filtering module is configured to deny a request where the query string is too long.
有没有办法覆盖它,以便我能够处理任何大小的请求?
如果没有,有没有办法在不使用文件系统/active x 对象的情况下在客户端生成文件?
谢谢
最佳答案
将以下内容添加到您的 web.config 中:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="32768"/>
</requestFiltering>
</security>
</system.webServer>
参见:
http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits
已更新以反射(reflect)评论。
requestLimits Element for requestFiltering [IIS Settings Schema]
您可能还需要在 web.config 中添加以下内容
<system.web>
<httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>
</system.web>
参见:httpRuntime Element (ASP.NET Settings Schema)
当然,上面配置设置中的数字(32768 和 65536)只是示例。您不必使用这些确切的值。
关于c# - 如何配置 web.config 以允许任意长度的请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11636386/