Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Static Variable vs View State (http://www.velocityreviews.com/forums/t604722-static-variable-vs-view-state.html)

Nil 04-09-2008 10:55 AM

Static Variable vs View State
 
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 04-09-2008 12:17 PM

Re: Static Variable vs View State
 
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



George Ter-Saakov 04-09-2008 12:55 PM

Re: Static Variable vs View State
 
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" <Nil@discussions.microsoft.com> 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
>
>




Peter Bromberg [C# MVP] 04-09-2008 05:38 PM

RE: Static Variable vs View State
 
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
>
>



All times are GMT. The time now is 12:00 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.