View Single Post
  #3 (permalink)  
Old January 27th, 2012, 10:06 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Quote:
Are there any hard and fast rules in .NET for any of this when making these considerations?
No. You need to outweigh the pros and cons. If it's not directly clear, you'll need to measure performance and network trafic.

A complex number that takes 1 minute to calculate but only takes up the size of an integer is a good candidate to store in ViewState (if it doesn't have to be updated each time). A DataSet with 4000 records is clearly not a good candidate to store in ViewState. You could store it in the Cache, recreate it after each postback, or find ways to query fewer records on each call (but still not store them in ViewState).

Hope this helps a bit.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote