Sets the state of the System.Web.UI.StateBag object as well as the System.Web.SessionState.ISessionStateItemCollection.Dirty property of each of the System.Web.UI.StateItem objects contained by it.
The StateBag.SetDirty(bool) method is used to force the collection and its contents to be serialized during a call to the System.Web.UI.StateBag.System.Web.UI.IStateManager.SaveViewState method.