Static Variable vs View State

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
 
H

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

Hans Kesting
 
G

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top