N
Nathan Sokalski
I am recieving the following error on the second postback of a page I have
written:
The state information is invalid for this page and might be corrupted
Stack Trace:
[FormatException: Invalid character in a Base-64 string.]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String
serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter,
String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +140
[ViewStateException: Invalid viewstate.
Client IP: 156.12.154.213
Port: 4212
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
ViewState:
/wEPDwUKMTU5MTA2ODYwOWRkss85+lCwdpXAiRIXg3K0QPiFDCk=,/wEPDwUJNzM0NTM2OTI4ZGR70CFkynUOZFCdEqpCi5JMYQiXmw==
Referer: http://www.nathansokalski.com/screenscraper.aspx
Path: /screenscraper.aspx]
[HttpException (0x80004005): The state information is invalid for this page
and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String
persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.HiddenFieldPageStatePersister.Load() +240
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
System.Web.UI.Page.LoadAllState() +35
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +64
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.210
The page is supposed to allow you to enter a URL and then display that page
below the small form that is in my code, which is as follows:
ScreenScraper.aspx:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="ScreenScraper.aspx.vb" Inherits="WebApplication1.ScreenScraper"
EnableViewState="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ScreenScraper</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txtSourcePath" runat="server" Width="800px"/>
<asp:Button ID="btnGetSource" runat="server" Font-Bold="True"
Text="Get Source" Width="85px"/><br/><br/>
<asp:Label ID="lblSource" runat="server"/>
</form>
</body>
</html>
ScreenScraper.aspx.vb:
Partial Public Class ScreenScraper : Inherits System.Web.UI.Page
Protected Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnGetSource.Click
Dim source As New System.Net.WebClient()
Dim utf8 As New System.Text.UTF8Encoding()
lblSource.Text =
utf8.GetString(source.DownloadData(txtSourcePath.Text))
End Sub
End Class
Most of the web pages I could find about this error said it was related to
ViewState, but my *.aspx file has EnableViewState="false" in the Page
directive. My code works fine with every URL I have tried it with when it is
the first URL I try, but the second one always gives me the error shown
above. I tried everything I could think of, but nothing seemed to help.
Although it may not be sufficient for other applications or pages, for this
page just having a way to make it act as if it being opened for the first
time would make it work (kind of like a reset or restart command?). Thanks.
written:
The state information is invalid for this page and might be corrupted
Stack Trace:
[FormatException: Invalid character in a Base-64 string.]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String
serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter,
String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +140
[ViewStateException: Invalid viewstate.
Client IP: 156.12.154.213
Port: 4212
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
ViewState:
/wEPDwUKMTU5MTA2ODYwOWRkss85+lCwdpXAiRIXg3K0QPiFDCk=,/wEPDwUJNzM0NTM2OTI4ZGR70CFkynUOZFCdEqpCi5JMYQiXmw==
Referer: http://www.nathansokalski.com/screenscraper.aspx
Path: /screenscraper.aspx]
[HttpException (0x80004005): The state information is invalid for this page
and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String
persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.HiddenFieldPageStatePersister.Load() +240
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
System.Web.UI.Page.LoadAllState() +35
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +64
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.210
The page is supposed to allow you to enter a URL and then display that page
below the small form that is in my code, which is as follows:
ScreenScraper.aspx:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="ScreenScraper.aspx.vb" Inherits="WebApplication1.ScreenScraper"
EnableViewState="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ScreenScraper</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txtSourcePath" runat="server" Width="800px"/>
<asp:Button ID="btnGetSource" runat="server" Font-Bold="True"
Text="Get Source" Width="85px"/><br/><br/>
<asp:Label ID="lblSource" runat="server"/>
</form>
</body>
</html>
ScreenScraper.aspx.vb:
Partial Public Class ScreenScraper : Inherits System.Web.UI.Page
Protected Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnGetSource.Click
Dim source As New System.Net.WebClient()
Dim utf8 As New System.Text.UTF8Encoding()
lblSource.Text =
utf8.GetString(source.DownloadData(txtSourcePath.Text))
End Sub
End Class
Most of the web pages I could find about this error said it was related to
ViewState, but my *.aspx file has EnableViewState="false" in the Page
directive. My code works fine with every URL I have tried it with when it is
the first URL I try, but the second one always gives me the error shown
above. I tried everything I could think of, but nothing seemed to help.
Although it may not be sufficient for other applications or pages, for this
page just having a way to make it act as if it being opened for the first
time would make it work (kind of like a reset or restart command?). Thanks.