We had the same problem not a long ago and after a lot of searching the following code has solved the problem:
protected override object LoadPageStateFromPersistenceMedium()
{
string viewState = Request.Form["__VSTATE"];
LosFormatter formatter = new LosFormatter();
return formatter.Deserialize(viewState);
}
protected override void SavePageStateToPersistenceMedium(object viewState)
{
LosFormatter formatter = new LosFormatter();
System.IO.StringWriter writer = new System.IO.StringWriter();
formatter.Serialize(writer, viewState);
string viewStateString = writer.ToString();
ClientScript.RegisterHiddenField("__VSTATE", viewStateString);
}
We have put it in the view in script tags, which is not very beautiful, but it works...
Further details see:
http://stackoverflow.com/questions/121579 and
http://www.codeproject.com/KB/viewstate/ViewStateCompression.aspx