By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,447 Members | 1,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,447 IT Pros & Developers. It's quick & easy.

ERROR: The state information is invalid for this page and might be corrupted

P: n/a
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(Str ing inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter.Deserialize(String
serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFor matter 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(Except ion inner, String
persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.HiddenFieldPageStatePersister.Load() +240
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +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(Http Context context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute()
+154
System.Web.HttpApplication.ExecuteStep(IExecutionS tep 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.T ext))
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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Dec 9 '06 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Nathan,

have you tried checking for IsPostback in the Page_Load event ?

i.e., let the code run if it's *not* a Postback and if it *is* a Postback, not let it run.

Sub Page_Load

If Not IsPostBack
' your screen scrape code

End If
End Sub

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:O3****************@TK2MSFTNGP06.phx.gbl...
>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(Str ing inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter.Deserialize(String
serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFor matter 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(Except ion inner, String persistedState, String
errorPageMessage, Boolean macValidationError) +116
System.Web.UI.HiddenFieldPageStatePersister.Load() +240
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +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(Http Context context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionS tep 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.T ext))
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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Dec 10 '06 #2

P: n/a
Other than the first time, doesn't it have to be a postback in order for
Page_Load to even get triggered? I know how to check whether something is a
postback, but since I am expecting this to always be a postback, I don't see
much point in checking since if btnGetSource_Click is being called I know it
is a postback, since I never call btnGetSource_Click from within the code.
If I am misunderstanding your suggestion, could you try posting it? The code
that you posted would not let the user specify the URL, and it would only do
one screenscrape. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uG**************@TK2MSFTNGP03.phx.gbl...
Nathan,

have you tried checking for IsPostback in the Page_Load event ?

i.e., let the code run if it's *not* a Postback and if it *is* a Postback,
not let it run.

Sub Page_Load

If Not IsPostBack
' your screen scrape code

End If
End Sub

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:O3****************@TK2MSFTNGP06.phx.gbl...
>>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(Str ing inputString) +72

System.Web.UI.ObjectStateFormatter.System.Web.UI. IStateFormatter.Deserialize(String
serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFor matter 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(Except ion inner, String
persistedState, String
errorPageMessage, Boolean macValidationError) +116
System.Web.UI.HiddenFieldPageStatePersister.Load() +240
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +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(Http Context context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4

System.Web.CallHandlerExecutionStep.System.Web.Ht tpApplication.IExecutionStep.Execute()
+154
System.Web.HttpApplication.ExecuteStep(IExecutionS tep 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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/



Dec 10 '06 #3

P: n/a
re:
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
Hi, Nathan.

I checked the page and what it produces is really curious.

I was able to get several pages in a row from my domain without problem.
Then I requested Microsoft's main page. No problem, either.
Then I requested Google's main page. It faulted with this error text :

---000---
Invalid postback or callback argument. Event validation is enabled using
<pages enableEventValidation="true"/in configuration or
<%@ Page EnableEventValidation="true" %in a page.

For security purposes, this feature verifies that arguments to postback or callback
events originate from the server control that originally rendered them.
If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation
method in order to register the postback or callback data for validation.
---000---

You might want to consider looking into that.

Also, I notice that you have different versions of the .Net Framework installed :
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
That could certainly be a problem in many scenarios,
including the ones in your post and my response.

It looks like you installed SBS or some other Windows 2003 server OS
which was running a beta version of ASP.NET (version 2.0.50727.210),
and when you upgraded to the RTM/release, some part of the setup didn't complete.

It would be highly advantageous for you to fully upgrade to the RTM version (2.0.50727.42).

Running aspnet_regiis -i should do it( from the .Net Framework 2.0 directory ),
if you don't have ASP.NET 1.1 apps running.

If you do have ASP.NET 1.1 apps running, you can re-register them with
aspnet_regiis -s ( from the .Net Framework 1.1 directory )

Remember to run 1.1 apps and 2.0 apps in different Application Pools.

Re your comment about it always being a postback, yes, you're right.
Sorry for misunderstanding the purpose of the page.

Hope these comments help you sort the situation.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:Ow**************@TK2MSFTNGP04.phx.gbl...
Other than the first time, doesn't it have to be a postback in order for Page_Load to even get
triggered? I know how to check whether something is a postback, but since I am expecting this to
always be a postback, I don't see much point in checking since if btnGetSource_Click is being
called I know it is a postback, since I never call btnGetSource_Click from within the code. If I
am misunderstanding your suggestion, could you try posting it? The code that you posted would not
let the user specify the URL, and it would only do one screenscrape. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uG**************@TK2MSFTNGP03.phx.gbl...
>Nathan,

have you tried checking for IsPostback in the Page_Load event ?

i.e., let the code run if it's *not* a Postback and if it *is* a Postback, not let it run.

Sub Page_Load

If Not IsPostBack
' your screen scrape code

End If
End Sub

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:O3****************@TK2MSFTNGP06.phx.gbl...
>>>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(Str ing inputString) +72

System.Web.UI.ObjectStateFormatter.System.Web.UI .IStateFormatter.Deserialize(String
serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFor matter 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(Except ion inner, String persistedState, String
errorPageMessage, Boolean macValidationError) +116
System.Web.UI.HiddenFieldPageStatePersister.Load() +240
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +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(Http Context context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.screenscraper_aspx.ProcessRequest(HttpContext context) +4

System.Web.CallHandlerExecutionStep.System.Web.H ttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionS tep 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.T ext))
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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Dec 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.