对于在页面加载时在 gridview 中绑定超过 500 条记录的 ASP 页面,我在单击按钮时遇到以下异常。
我的页面没有任何上传控件。它包含一个文本框、按钮和网格视图。
有谁知道为什么会发生这种情况。
异常描述:
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.
回发发送回每个控件的视图状态 - 如果您有一个巨大的数据网格,那么当浏览器将其重新发布到服务器时,这就是您收到异常的原因。
您的两个选择是:
- Set
EnableViewState="false"
在你的 GridView 上,如果你不需要视图状态,那么它不会那么臃肿,并且回发的大小是合理的,
-
增加最大请求大小web.config
如下所示:
<configuration>
<system.web>
<httpRuntime maxRequestLength="32768" />
</system.web>
</configuration>
希望这可以帮助
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)