?
Solved

getting " The state information is invalid for this page and might be corrupted." error on saving viewstate into session

Posted on 2009-02-17
7
Medium Priority
?
1,290 Views
Last Modified: 2012-06-21
I have web page, which has tree update pannles.
and along with that two radio button and 3 image buttons.
in update pannel 1 contains one tree control.
and user select one radio button then clicks on the button to load the tree control.
I have override the two function given below to save viewstate but when i select one radio button and clicks on load tree button i am getting the erro give in the title field.

could any one help me here why i am getting this error.
protected override object LoadPageStateFromPersistenceMedium()
    {
        return Session["ViewState"];
    }
    protected override void SavePageStateToPersistenceMedium(object viewState)
    {
        Session["ViewState"] = viewState;
        // Bug requires Hidden Form Field __VIEWSTATE
        ClientScript.RegisterHiddenField("__VIEWSTATE", "");
    }

Open in new window

0
Comment
Question by:ziorrinfotech
  • 3
  • 3
7 Comments
 
LVL 15

Expert Comment

by:Praveen Venu
ID: 23667358
0
 

Author Comment

by:ziorrinfotech
ID: 23667523
I read that article but it did not helped me
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 23673261
The hidden field "__VIEWSTATE" is used to store control's state information and used for the server to restore the control's state information. The server will validate if the data stored in it has been tampered before restoring the state, so if validation fails, the server will throw error and will not restore the control's state information.
Why do you need to change this hidden field which cause the validation to fail?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:ziorrinfotech
ID: 23673483
Hi prairiedog

All I want is so save the state of the page so that when user come back to the page , then he should get  the same setting/view which was there before he leaves the page.

Is there any different way to do this?
0
 
LVL 22

Expert Comment

by:prairiedog
ID: 23673577
There should be many ways to do it depending on your exact requirements. Can you specify what state do you need to save? Can you give more information on the page?
0
 

Author Comment

by:ziorrinfotech
ID: 23673809
sure prairiedog,
here is all about my web page.

on my web page, I have three update panels. along with that 2 radio buttons and one button which are out side the update panels.
Update panel 1 contains one tree control.
Update panel 2 and 3 contains html table runat server


now user select one radio button and click on the load button to load the tree control.
after tree control is loaded then user select nodes from the tree control and clicks on show node button to view summary information of the selected nodes in update panel`s 2 html table.

lastly user selects one row from update panel 2 to view that article in full details in the update panel 3 html table.

I know html table contents by default doesn't get save in the viewstate so for these i need to write a function.

but some how i save the radio button selection and tree control info and load it back again so that user does not have to do the process again and again.

I hope i am clear, pls let me know for any query
0
 
LVL 22

Accepted Solution

by:
prairiedog earned 375 total points
ID: 23674049
Save the radion button selection and tree control node selection in session variables instead of view state, because the life scope of the view state is only within the page. When user navigates away to a different page, the view state of the previous page is destroyed.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question