ASP.Net Treeview AND HTML Table. Error : Maximum request length exceeded

ASP.Net Treeview AND HTML Table. Error : Maximum request length exceeded

我在我的网页中使用树视图,它在 4 个父节点级别绑定了大约 2000 条记录:

A : bind child node count =1
B : bind child node count =25
C : bind child node count = 250
D : bind child node count = 1800

单击这些节点时,会出现一个文字控件,我在其上渲染代码隐藏的 HTML table。

The data displayed in html table for node A is 1 row 20 column.
The data displayed in html table for node B is 25 row 20 column.
The data displayed in html table for node C is 250 row 20 column.
The data displayed in html table for node D is 1800 row 20 column.

当我在树视图的 SelectedNodeChenaged 事件上渲染这些 table 时。选择 4 到 5 后,页面会给出错误消息。 超出最大请求长度。 System.Web.HttpException: 超出最大请求长度。

现在我知道我正在处理的数据非常庞大。我猜问题可能出在大视野 states.But 我无法找到解决方案。请帮忙提出建议。

尝试过的解决方案是:

1. disabling view state for the treeview :-(
2. disabling view state for the HTML tables rendered on literal control. :-(
3. setting maxJsonLength="5000000" in web.config. :-(

提前致谢。

在 webconfig 中试试这个

Browsers, and HTML in general, were never designed to handle large uploads
gracefully.
If you need to upload files larger than 4 MB, 
you can modify the web.config file manually to change the maximum request length


<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="5000000" />
</system.web>

来自MSDN

Specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server.