Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Static Variable vs View State

Reply
Thread Tools

Static Variable vs View State

 
 
Nil
Guest
Posts: n/a
 
      04-09-2008
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


 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      04-09-2008
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/lib...er(VS.80).aspx

Hans Kesting


 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      04-09-2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      04-09-2008
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...ut-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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static variable vs View State Nil ASP General 2 04-09-2008 09:53 PM
Maybe a static method and/or View State? CK ASP .Net 1 05-23-2006 03:30 PM
non-static variable this cannot be referenced from a static context kookey Java 3 08-20-2005 07:43 PM
How to make a week view and day view calendar just like month view calendar in .NET ? Parthiv Joshi ASP .Net Web Controls 1 07-06-2004 03:15 PM
a static local variable in a static method is thread local storage? Patrick Hoffmann C++ 3 08-08-2003 02:37 PM



Advertisments