Static Variable vs View State

  • Thread starter Thread starter Nil
  • Start date Start date
N

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

Hans Kesting
 
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.
 
Back
Top