Back to Questions

Does ViewState affect performance? What is the ideal size of a ViewState? How can you compress a viewstate?

Your Answer

  • 12/18/2012 3:36:43 PM
  • Biju
  • 1

Does ViewState affect performance? What is the ideal size of a ViewState? How can you compress a viewstate?

Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.

Viewstate can be compressed to almost 50% of its size. .NET also provides the GZipStream or DeflateStream to compress viewstate. Another option is explained by Scott Hanselmann over here.

  • 12/18/2012 3:37:05 PM
  • test

Back to Questions