protected LosFormatter losFormatter = new LosFormatter();
protected override object LoadPageStateFromPersistenceMedium()
{
string key = Request.RawUrl + "__viewstate";
if (Session[key] != null)
{
object obj = null;
using (System.IO.MemoryStream stream = (System.IO.MemoryStream)Session[key])
{
stream.Seek(0, System.IO.SeekOrigin.Begin);
obj = losFormatter.Deserialize(stream);
}
Session[key] = null;
return obj;
}
return null;
}
protected override void SavePageStateToPersistenceMedium(object viewState)
{
string key = Request.RawUrl + "__viewstate";
System.IO.MemoryStream stream = new System.IO.MemoryStream();
losFormatter.Serialize(stream, viewState);
stream.Flush();
Session[key] = stream;
}