Static Variable vs View State

Static Variable vs View State

am 09.04.2008 12:55:01 von Nil

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

Re: Static Variable vs View State

am 09.04.2008 14:17:25 von Hans Kesting

Nil formulated on woensdag :
> 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

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.sessi onpagestatepersister(VS.80).aspx

Hans Kesting

Re: Static Variable vs View State

am 09.04.2008 14:55:15 von George Ter-Saakov

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.


"Nil" wrote in message
news:3EF6CDDB-7995-4FE1-B2D7-B18E6CAF5528@microsoft.com...
> 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
>
>

RE: Static Variable vs View State

am 09.04.2008 19:38:02 von pbromberg

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-42 67-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


"Nil" wrote:

> 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
>
>