由于查询字符串长度导致的缓冲区溢出

时间:2013-05-17 07:26:51

标签: asp.net-mvc buffer-overflow

我有这样的网址,

http://domain.com?a=1&b=something&c=something

我正在访问服务器端的所有这些查询字符串以执行某些过程。

现在如果有人为参数b发送大约4036个字符的大文本,我收到缓冲区溢出错误。

在ASP.NET MVC4中处理此问题的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

我认为这是由于达到最大请求长度方法。如果是这样,您可以通过将最大请求长度设置为更高的值来解决此问题。您可以通过设置 httpRuntime 元素的 maxRequestLength 属性来更改此值:

<configuration>
    <system.web>
        <!-- This will set the maximum request length to 30720 KB (30MB).
             The default is 4096 KB (4MB) -->
        <httpRuntime maxRequestLength="30720" />
    </system.web>
</configuration>