viewstate problem - invalid state information

Posted by RohiK under C# on 4/11/2011 | Points: 10 | Views : 4425 | Status : [Member] | Replies : 8
Hi all,

I have a site to solve issues.
I found following code for on each page. I think they used it to compress page viewstate
protected override void SavePageStateToPersistenceMedium(object pageViewState)
{
LosFormatter losformatter = new LosFormatter();
StringWriter sw = new StringWriter();
losformatter.Serialize(sw, pageViewState);
string viewStateString = sw.ToString();
byte[] b = Convert.FromBase64String(viewStateString);
b = ViewStateCompressor.CompressViewState(b);
ClientScript.RegisterHiddenField("__CUSTOMVIEWSTATE", Convert.ToBase64String(b));
}

Deserialize view state
protected override object LoadPageStateFromPersistenceMedium()
{
string custState = Request.Form["__CUSTOMVIEWSTATE"];
byte[] b = Convert.FromBase64String(custState);
b = ViewStateCompressor.DecompressViewState(b);
LosFormatter losformatter = new LosFormatter();
return losformatter.Deserialize(Convert.ToBase64String(b));
}

but when I comment this one and run that then it gives me error in IE not in Firefox.
I don't want that code in new site because new site is different in design and all so I am not generating large viewstate.
how to resolve this problem?
plz help

Happy Programming!!
Rohi



Responses

Posted by: Gsolvers on: 4/11/2011 [Member] Starter | Points: 25

Up
0
Down
Can you send complete .aspx page to me?

Best Regards,

VG
www.TeacherJi.com

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 4/11/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

I mentioned In every page they have written this code.
I found error on login page and many pages where they fired javascript validations.
I have to search there.
But I need help why this happens?

what is the meaning of this error- The state information is invalid for this page and might be corrupted.


Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gsolvers on: 4/11/2011 [Member] Starter | Points: 25

Up
0
Down
Does this error comes all the time?


Please see the below link which might fix your issue.

http://support.microsoft.com/kb/323744

Best Regards,

VG
www.TeacherJi.com

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 4/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
What is the exact error you get?

Thanks
Karthik
www.f5Debug.net

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 4/11/2011 [Member] Starter | Points: 25

Up
0
Down
sometimes the error shown on the left corner
with yellow symbol
Sys.WebForms.PageRequestManagerServerErrorException :The state information is invalid for this page and might be corrupted.
and nothing happens if i clicked on any button.

and now I found one thing the page loads 2 times. means I put debugger on page load. the control comes 2 times in page load.

I can't find it out why this is so?

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 4/11/2011 [Member] Starter | Points: 25

Up
0
Down
and the issue comes in IE only not in FF

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 4/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
IE which version you are using? i can see many issues in 8 and 7... do u use any one of them?

Thanks
Karthik
www.f5Debug.net

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 4/13/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Karhik,

thanks 4 reply.
yes I m facing this problem in IE8 and 7.
but whats the solution then?

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response