tags:

views:

123

answers:

2

hi, i have read that you can do it, but would this really improve performance of the page, or would it bring more performance overhead ?

thanks in advanced.

+3  A: 

Here's a good article by Scott Hanselman about storing ViewState information in the Session object:

Moving ViewState to the Session Object and more Wrongheadedness

Phaedrus
+1  A: 

Viewstate data is information about the page that is encrypted and serialized into a hidden tag on the page.

If you could store it in the session these are some of the problems/pitfalls:

  • The information still has to be encrypted/decrypted and serialized/deserialized from memory
  • If you have a lot of users and your session data is stored in process or even using a state server, you're going to max out the memory on these servers with viewstate data.
  • If you're using SQL Server for session state this obviously gets worse (see below).

If you could store it in SQL Server these would be some of the problems:

  • Again, information still has to be serialized/deserialized (not necessarily encrypted/decrypted since it's not output to the page), but in this case it has to be read/written from a SQL DB. You will incur overhead in both transmission to/from the DB and I/O when reading/writing from/to the DB.
triniMahn
man, great points out there, so i think the best thing to do with viewstate is to compress it, and minimize using it when possible
Yes, if you can minimize using it altogether then that would be your best bet.
triniMahn