视图状态的优化 [英] Viewstate Optimisations
问题描述
海兰,
我很感兴趣,在视图状态的asp.net AJAX项目的一些普通的优化方法
I'm interested in some general optimisation methods in an asp.net ajax project for Viewstate
(例如,以减少视图状态的大小,
或者只是加快视图状态不知何故,
或其他人,这应该是一个一般性讨论:-))。
(ex. to reduce the size of viewstate , or just speeding up the viewstate somehow, or others this should be a general discussion :-) ).
所以,你用什么样的优化为ViewState的?
在Asp.net或Ajax框架提供哪些可能性?
So what kind of optimisation do you use for ViewState? What possibilities are offered on Asp.net or Ajax framework?
推荐答案
@silky是正确的,禁用它在任何你可以。我们尽量保持在尽可能多的控制尽可能禁用。
@silky is right, disable it where ever you can. We try to keep it disabled on as many controls as possible.
此外,一旦你使用尽可能少的,它的可能的是值得考虑的把这样的事情在你的页面(或更好基页类)
Also, once you're using as little as possible, it might be worth looking at putting something like this in you pages (or better a base page class)
Protected Overrides ReadOnly Property PageStatePersister() As PageStatePersister
Get
Return New SessionPageStatePersister(Me)
End Get
End Property
但是,这取决于你有多少用户你有和有多少内存,它假定你正在使用的会话。
But that depends on how many users you have and how much memory you have and it assumes that you are using sessions.
呵呵,并在C#是:
protected override PageStatePersister PageStatePersister
{
get
{
return new SessionPageStatePersister(this);
}
}
这篇关于视图状态的优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!