Hi,
I am facing problem with the huge Viewstate size(Using .NET 2.0).
to improve the application performance,
I am using Static variable to store view state data.
Does anyone has other option to improve performance or what r drawback of
using Static variable.
Thanks,
Nil
Hans Kesting - 09 Apr 2008 13:17 GMT
Nil formulated on woensdag :
> Hi,
> I am facing problem with the huge Viewstate size(Using .NET 2.0).
[quoted text clipped - 5 lines]
> Thanks,
> Nil
One thing to watch out for is that a static variable is visible to ALL
users. So do not store user-specific information in it: you will
overwrite the info of the other users.
You can always set EnableViewState to "false" for all controls where
you don't use it.
Or maybe use the SessionPageStatePersister class (never used it myself)
http://msdn2.microsoft.com/en-us/library/system.web.ui.sessionpagestatepersister
(VS.80).aspx
Hans Kesting
George Ter-Saakov - 09 Apr 2008 13:55 GMT
They kind of not interchangeable.....
ViewState is per browser/request and static variable is the same for all
users.
You can look up on Google how to keep ViewState in a Session so it's not
passed to browser back and force...
But it's better to find another solution...
George.
> Hi,
> I am facing problem with the huge Viewstate size(Using .NET 2.0).
[quoted text clipped - 5 lines]
> Thanks,
> Nil
Peter Bromberg [C# MVP] - 09 Apr 2008 18:38 GMT
I agree with Hans. First you want to reduce the size of Viewstate as much as
possible.
Second, store it on the server with the SessionPageStatePersister. I wrote
up a short article on this that illustrates how easy it is:
http://www.eggheadcafe.com/tutorials/aspnet/b48875f6-525b-4267-a3a8-64dd33bfc2fe
/keep-viewstate-out-of-pag.aspx
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
> Hi,
> I am facing problem with the huge Viewstate size(Using .NET 2.0).
[quoted text clipped - 5 lines]
> Thanks,
> Nil