• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

System.Web.HttpException: The viewstate is invalid for this page and might be corrupted.

Hi

I am getting the following error "The viewstate is invalid for this page and might be corrupted"  in opening a page. what should be done to resolve this problem.

The following is the compiled output of the error file.

Thanks in advance

***************************************************************************************
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The viewstate is invalid for this page and might be corrupted.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
Stack Trace:
[HttpException (0x80004005): The viewstate is invalid for this page and might be corrupted.]
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +150
   System.Web.UI.Page.LoadPageViewState() +18
   System.Web.UI.Page.ProcessRequestMain() +423
**************************************************************************************
0
dnlakhani
Asked:
dnlakhani
  • 2
  • 2
1 Solution
 
BurntSkyCommented:
This happens when you first navigate to a page?  Or after a postback?  I assume you've tried closing and reopening the browser window (as well as rebooting the machine).

Take a look at this Microsoft KB article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;831150

It might help you retrieve a more thorough explanation of the error.  If you think you know what code might be causing the problem, please post it as it will help the troubleshooting process.
0
 
dnlakhaniAuthor Commented:
Hi

I have referred to this site already but didn't find anything interesting out there...!

Well I think U will be able to understand this better if I explain u the  situation.
I have a  form which has three frames in it. Now our discussion is going to be regarding the left frame and the central frame.

Lets say the left frame has the form tsdocumentsearch.aspx in it. This form has an image from where another aspx form called searchresults.aspx form is being called so this has to open in the centre frame.

This is the code for the tsdocumentsearch.aspx
********************************************************
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Tsdocumentsearch.aspx.vb" Inherits="IRDtsearchDevelopmentnew.Tsdocumentsearch"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<SCRIPT language =javascript>
function checkingpeop()
{
document.Form1.action = "SearchResults.aspx?";      
return true;
}
</SCRIPT>
<HTML>
      <HEAD>
            <title>Tsdocumentsearch</title>
            <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
            <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
            <link href="ir.css" rel="stylesheet" type="text/css">
            <link href="scroll.css" rel="stylesheet" type="text/css">
            <base target = main>
      </HEAD>
      <body bgColor="#cedbef" MS_POSITIONING="GridLayout">
            <form id="Form1" method="post" runat="server">
                  <font color="#000000">
                        <asp:label Font-Bold="True" id="Label1" runat="server" style="Z-INDEX: 101; LEFT: 11px; POSITION: absolute; TOP: 49px" class="FontStyle">
        Search Request</asp:label>
                        <asp:textbox class="TitleBtn" id="SearchRequest" style="Z-INDEX: 102; LEFT: 9px; POSITION: absolute; TOP: 71px" runat="server" Width="189px" Height="25px" TextMode="MultiLine"></asp:textbox>
                        <asp:button id="SearchButton" style="Z-INDEX: 103; LEFT: 11px; POSITION: absolute; TOP: 108px" runat="server" Width="75px" Height="20px" Text="Search" CssClass="sortbtn"></asp:button>
                        <input type="image" src="go.gif" onclick="return checkingpeop();" width="19" height="14">
                        <asp:label Height="21px" id="Label2" runat="server" Width="129px" style="Z-INDEX: 105; LEFT: 11px; POSITION: absolute; TOP: 170px" class="FontStyle">
       Documents found:</asp:label>
                        <asp:label id="FileCount" style="Z-INDEX: 104; LEFT: 148px; POSITION: absolute; TOP: 170px" runat="server" Font-Bold="True" Width="97px" Height="20px"></asp:label>
                        <asp:datagrid id="SearchResultsGrid" style="Z-INDEX: 107; LEFT: 12px; POSITION: absolute; TOP: 200px" runat="server" Width="449px" Height="473px" AllowPaging="True" BackColor="#B7D0E4" CssClass="FontStyle">
                              <AlternatingItemStyle BorderStyle="Solid" CssClass="fontstyle" BackColor="Transparent"></AlternatingItemStyle>
                              <HeaderStyle Font-Bold="True" ForeColor="Black" CssClass="fontstyle" BackColor="PeachPuff"></HeaderStyle>
                              <PagerStyle Font-Bold="True" HorizontalAlign="Left" Mode="NumericPages"></PagerStyle>
                        </asp:datagrid></form>
            </BLINK></FONT></B>
            <ITEMSTYLE BackColor="AntiqueWhite"></ITEMSTYLE>
            <HEADERSTYLE Font-Bold="True" BorderWidth="2px" BorderColor="#0000C0"></HEADERSTYLE></FORM>
      </body>
</HTML>
********************************************************
So when we try to click on the Go button the error "System.Web.HttpException: The viewstate is invalid for this page and might be corrupted." occurs

This is the code for the parent form which calls all the  three frames:
***********************************************************
<%@ Page %>
<html>
      <head>
            <title>Welcome to T.S Search</title>
      </head>
      <frameset name="mainFrame" frameborder="0" framespacing="0" border="0" cols="*" rows="68,*,20">
            <frame name="banner" marginwidth="0" marginheight="0" target="main" src="maintoptssearch.aspx" name="heading" noresize scrolling="no">
            <frameset name="sideFrame" frameborder="0" framespacing="0" border="0" cols="200,12,*" rows="*">
                  <frameset name="innerFrame" frameborder="0" framespacing="0" border="0" cols="*" rows="1000,0,*">
                        <frame marginwidth="8" marginheight="0" name="contents" target="main" src="tsdocumentsearch.aspx?Type=People" name="code" noresize scrolling="auto" frameborder="0">
                  </frameset>
                  <frame marginwidth="50" marginheight="50" src="toggle.html" name="toggle" noresize scrolling="auto">
                  <frameset name="innerFrameout" frameborder="0" framespacing="0" border="0" cols="*" rows="1000,*">
                        <frame marginwidth="5" marginheight="5" name="main" id="main" src="maintssearch.aspx" noresize scrolling="auto">
                  </frameset>
            </frameset>
      </frameset>
      <noframes>
            <p>The <code>NOFRAMES</code> element is to be used to give useful content to people
                  with browsers that cannot display frames. One example is Lynx, a text-based
                  browser.</p>
      </noframes>
      </frameset>
</html>

***********************************************************
pleased to give you any more clarifications
Thanks
0
 
YZlatCommented:
in the @Page directive set EnableViewStateMAC to false
0
 
YZlatCommented:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Tsdocumentsearch.aspx.vb" EnableViewStateMAC="false" Inherits="IRDtsearchDevelopmentnew.Tsdocumentsearch"%>
0
 
dnlakhaniAuthor Commented:

Thanks Yzalt

I was using this EnableviewstateMAc = "False" in the page initialize event that was the reason it didn't work
Any way thanks now it works fine..!

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now