在asp.net的ViewState组块 [英] ViewState Chunking in asp.net

查看:123
本文介绍了在asp.net的ViewState组块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断听到这句话视图状态组块。
什么是视图状态分块?

I keep on hearing this words "Viewstate Chunking". What is Viewstate Chunking?

和它是如何工作的ASP.NET页面?

And how it is working for ASP.NET pages?

推荐答案

当在你的页面视图状态变得非常大也可以是因为某些防火墙和代理将美元大量含有的ViewState大小的页面p $ pvent访问的问题。为此,ASP.NET引入了ViewState的分块机制。因此,ASP.NET使ViewState中的单个隐藏字段的分裂成好几个使用在web.config部分MaxPageStateFieldLength财产。

When the ViewState in your page becomes very large it can be a problem since some firewalls and proxies will prevent access to pages containing huge ViewState sizes. For this purpose ASP.NET introduces the ViewState Chunking mechanism. So ASP.NET enables splitting of the ViewState's single hidden field into several using the MaxPageStateFieldLength property in the web.config section.

当的MaxPageStateFieldLength属性被设置为正数,视图状态发送到客户端浏览器被分成多个隐藏字段

When the MaxPageStateFieldLength property is set to a positive number, the view state sent to the client browser is broken into multiple hidden fields.

在MaxPageStateFieldLength属性设置为负数(默认)表示视图状态字段应该不会被分隔成块。设置MaxPageStateFieldLength少数可能导致性能较差。

Setting the MaxPageStateFieldLength property to a negative number (the default) indicates that the view-state field should not be separated into chunks. Setting the MaxPageStateFieldLength to a small number may result in poor performance.

在样品的ViewState:

Sample ViewState before:

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"value="/wEPDwUKLTk2Njk3OTQxNg9kFgICAw9kFgICCQ88KwANAGQYAQUJR3Jp
ZFZpZXcxD2dk4sjERFfnDXV/hMFGAL10HQUnZbk=" />

然后在web.config中设置:

Then set in web.config:

<pages maxPageStateFieldLength="40">

样的ViewState后:

Sample ViewState After :

<input type="hidden" name="__VIEWSTATEFIELDCOUNT" id="__VIEWSTATEFIELDCOUNT"value="3" />
<input type="hidden" name="__VIEWSTATE"
id="__VIEWSTATE" value="/wEPDwUKLTk2Njk3OTQxNg9kFgICAw9kFgICCQ88" />
<input type="hidden" name="__VIEWSTATE1"
id="__VIEWSTATE1" value="KwANAGQYAQUJR3JpZFZpZXcxD2dk4sjERFfnDXV/" />
<input type="hidden" name="__VIEWSTATE2"
id="__VIEWSTATE2" value="hMFGAL10HQUnZbk=" /> 

希望它能帮助你!

hope it help you!

这篇关于在asp.net的ViewState组块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆