Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Need Advice on Viewstate

Reply
Thread Tools

Need Advice on Viewstate

 
 
=?Utf-8?B?amVubg==?=
Guest
Posts: n/a
 
      03-01-2004
Hi

I was using Sessionto persist datatables, but now I don't think it's good idea to do so as Session can cause overhead on the server (as the number of users grow), so I use ViewState to store the datatables instead.

I'm wondering what are the disadvantages of using ViewState against Session, beside the fact that the former slows the rendering of HTML as well as the data is visible to the user

Are there other issues I should be concerned about, such as memory overhead on the server, as the number of users grow? Are ViewState values unique to a session/page, or are they of application level? Is there a need for ViewState clean up (sounds silly because I think the answer is no, but I want to make sure

Thanks in advance for any reply.
 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      03-01-2004
ViewState and SessionState both exist for good reasons, and there are times
when using one or the other is a good idea. ViewState doesn't take up server
resources (memory), but it can slow down response time from the server due
to the amount of data being transmitted to the browser, and is only
persistent at Page scope. That is, ViewState only lives as long as the
current WebForm is loaded and posting back to itself. Once the user
navigates away from that Page, ViewState is lost. SessionState lasts an
entire single user Session, and is persistent across Pages. It does consume
some server resources during its lifetime, and can time out. Keeping these
in mind, and handling their eventualities should make SessionState a viable
storage persistence medium for objects with Session scope.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"jenn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I was using Sessionto persist datatables, but now I don't think it's good

idea to do so as Session can cause overhead on the server (as the number of
users grow), so I use ViewState to store the datatables instead.
>
> I'm wondering what are the disadvantages of using ViewState against

Session, beside the fact that the former slows the rendering of HTML as well
as the data is visible to the user.
>
> Are there other issues I should be concerned about, such as memory

overhead on the server, as the number of users grow? Are ViewState values
unique to a session/page, or are they of application level? Is there a need
for ViewState clean up (sounds silly because I think the answer is no, but I
want to make sure)
>
> Thanks in advance for any reply.



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      03-01-2004
No.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"jenn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Kevin,
>
> Thanks for the response. Sorry I wasn't clear on my previous post. The

purpose of my using ViewState to persist datatables is to store item info in
a shopping cart. So I only need them to persist during postbacks of a page.
So, I think Viewstate is good enough for this purpose. But, are there other
issues I that need to be concerned of?


 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      03-01-2004
yes, as your viewstate is tied to the page post, not the server, when the
user backs up thru the site using history, your shopping cart can easily
lose data.

i'd say that viewstate is a really bad design choice for a shopping cart.

-- bruce (sqlwork.com)



"jenn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Kevin,
>
> Thanks for the response. Sorry I wasn't clear on my previous post. The

purpose of my using ViewState to persist datatables is to store item info in
a shopping cart. So I only need them to persist during postbacks of a page.
So, I think Viewstate is good enough for this purpose. But, are there other
issues I that need to be concerned of?


 
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
Problems with ViewState: "function 'ViewState.get_Item' evaluated and returned null" Steph ASP .Net 2 05-11-2011 02:35 PM
Errors: Failed to load viewstate. & Validation of viewstate MAC failed. sck10 ASP .Net 6 09-01-2006 05:59 PM
Loading usercontrols, viewstate problem, slighly different from all others "viewstate uc problems" please help... ujjc001 ASP .Net 0 07-27-2005 01:52 PM
Viewstate errors... how do I get viewstate working? mark ASP .Net Building Controls 0 02-20-2004 02:17 PM
Corrupted ViewState (Yes, another issue concerning viewstate) Ben Rush ASP .Net 2 12-05-2003 04:17 PM



Advertisments