asp.net – 回发时超过最大请求长度异常

前端之家收集整理的这篇文章主要介绍了asp.net – 回发时超过最大请求长度异常前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在点击按钮时遇到以下异常,对于在页面加载时在gridview中绑定超过500条记录的asp页面.

我的页面没有任何上传控件.它包含一个文本框,按钮和gridview.
有谁知道为什么会这样.

例外说明:

Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

解决方法

回发发送回每个控件的视图状态 – 如果您有一个巨大的数据网格,那么当浏览器将其重新发送到服务器时,这就是您获得异常的原因.

你有两个选择:

>如果您不需要视图状态,请在GridView上设置EnableViewState =“false”,因此它不是那么臃肿而且回发是合理的大小,
>增加web.config中的最大请求大小,如下所示:

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="32768" />
    </system.web>
</configuration>

希望这可以帮助

原文链接:https://www.f2er.com/aspnet/246760.html

猜你在找的asp.Net相关文章