最大请求长度上回发超出异常 [英] Maximum request length exceeded exception on postback
问题描述
我得到一个按钮,点击下面的异常,对ASP页面,该页面在GridView在页面加载绑定500多条记录。
我的页面没有任何上传控制。它包含一个文本框,按钮和GridView控件。 有谁知道为什么发生这种情况。
异常说明:
超过最大请求长度。
描述:在当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细堆栈跟踪信息,以及它起源于code。
一个回发发回的每个控件的视图状态 - 如果你有一个庞大的数据网格,然后在浏览器转播,为服务器,这就是为什么你得到该异常。
您有两个选项:
- 设置
的EnableViewState =假
在你的GridView,如果你不需要视图状态,所以它不是那么臃肿和回发是一个合理的规模, -
增加
web.config中的最大请求大小
,如下所示:<结构> <的System.Web> <的httpRuntime maxRequestLength的=32768/> < /system.web> < /结构>
希望这有助于
I'm getting the following exception on a button click, for an asp page which binds more than 500 records in a gridview on page load.
My page does not have any upload control. It contains a textbox, button and the gridview. Does anyone know why this is happening.
Exception Description:
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.
A postback sends back the viewstate of every control - if you have a huge datagrid, then when the browser reposts that to the server, this is why you are getting the exception.
Your two options are:
- Set
EnableViewState="false"
on your GridView if you do not need the viewstate, so it's not so bloated and the postback is a reasonable size, Increase the maximum request size in
web.config
as shown below:<configuration> <system.web> <httpRuntime maxRequestLength="32768" /> </system.web> </configuration>
Hope this helps
这篇关于最大请求长度上回发超出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!