Wednesday, May 20, 2009

Completly Removing ViewState WebFroms

Here is the code to completely remove view state from the page:
#region ViewState

protected override void SavePageStateToPersistenceMedium(object viewState)
{
}

protected override object LoadPageStateFromPersistenceMedium()
{
return null;
}

#endregion
Make sure that none of the controls in the page rely on ViewState to function properly. {6230289B-5BEE-409e-932A-2F01FA407A92}

2 comments:

Bill said...

Does the EnableViewState="False" switch do something similar?

webmaster said...

EnableViewState="False" will not remove everything. There is still some unneeded internals writtent to the View State. However, setting EnableViewState="False" is the first step in getting everything cleaned up.

Post a Comment