ASP.NET 2.0 Performance Inspection Questions - View State

From Guidance Share

Jump to: navigation, search

- J.D. Meier, Srinath Vasireddy, Ashish Babbar, Rico Mariani, and Alex Mackman

Do you disable view state when it is not required?

Evaluate each page to determine if you need view state enabled. View state adds overhead to each request. The overhead includes increased page sizes sent to the client as well as a serialization and deserialization cost. You do not need view state under the following conditions:

  • The page does not post back to itself; the page is only used for output and does not rely on response processing.
  • Your page's server controls do not handle events and you have no dynamic or data-bound property values (or they are set in code on every request).
  • If you are ignoring old data and repopulating the server control every time the page is refreshed.

Have you taken steps to reduce the size of your view state?

Evaluate your use of view state for each page. To determine a page's view state size, you can enable tracing and see each how each control uses it. Disable view state on a control-by-control basis.

Related ITems

For more information about the questions and issues raised in this section, see ASP.NET 2.0 Performance Guidelines - View State.

Personal tools