'Unable to validate data' - Why is Viewstate corrupt?

S

sjl

I've got an .aspx webform for searching my database. It basically takes user
input and passes it as a parm into a stored proc to search a table. The
results are returned in a SQLDataReader and bound to a datagrid on the same
page. It works 90% of the time as expected. However, for some unknown
reason, I randomly get the error below. The HttpException says there is an
'Invalid_Viewstate'. Ok, but why? I'm posting back to the same page. If the
Viewstate is corrupt, then why?

I'm hosting at Orcs Web using shared hosting, ASP.NET 1.1, SQL 2000, VS2003.

***********ERROR MESSAGE DETAILS******************
Unable to validate data.
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.

Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60

[HttpException (0x80004005): Authentication of viewstate failed. 1) If this
is a cluster, edit <machineKey> configuration so all servers use the same
validationKey and validation algorithm. AutoGenerate cannot be used in a
cluster. 2) Viewstate can only be posted back to the same page. 3) The
viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102

[HttpException (0x80004005): Invalid_Viewstate
Client IP: xxxxxx
Port: 3639
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50215)
ViewState: dDwtMTUxMTMzMDAzMjt0 [clipped]
Http-Referer: http://xxxxxxxxxx/search.aspx
Path: /search.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
***********ERROR MESSAGE DETAILS******************

Thanks for any help you can provide.
SJL
 
S

S. Justin Gengo

sjl,

You should inquire of your webhost as to whether they are hosting via a
clustered environment. As the error states if they are you will need the
<machineKey> edited for the clusted environment.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

sjl

Justin. Thanks for the reply, unfortunately, I'm told by my host:

"Your site is being hosted on one of our shared servers which is not a
clustered environment. Only our webfarm servers are in a clustered
environment, which your site is not on."

Any other ideas?

SJL


S. Justin Gengo said:
sjl,

You should inquire of your webhost as to whether they are hosting via a
clustered environment. As the error states if they are you will need the
<machineKey> edited for the clusted environment.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
sjl said:
I've got an .aspx webform for searching my database. It basically takes
user input and passes it as a parm into a stored proc to search a table.
The results are returned in a SQLDataReader and bound to a datagrid on
the same page. It works 90% of the time as expected. However, for some
unknown reason, I randomly get the error below. The HttpException says
there is an 'Invalid_Viewstate'. Ok, but why? I'm posting back to the
same page. If the Viewstate is corrupt, then why?

I'm hosting at Orcs Web using shared hosting, ASP.NET 1.1, SQL 2000,
VS2003.

***********ERROR MESSAGE DETAILS******************
Unable to validate data.
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.

Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60

[HttpException (0x80004005): Authentication of viewstate failed. 1) If
this is a cluster, edit <machineKey> configuration so all servers use the
same validationKey and validation algorithm. AutoGenerate cannot be used
in a cluster. 2) Viewstate can only be posted back to the same page. 3)
The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102

[HttpException (0x80004005): Invalid_Viewstate
Client IP: xxxxxx
Port: 3639
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50215)
ViewState: dDwtMTUxMTMzMDAzMjt0 [clipped]
Http-Referer: http://xxxxxxxxxx/search.aspx
Path: /search.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
***********ERROR MESSAGE DETAILS******************

Thanks for any help you can provide.
SJL
 
S

S. Justin Gengo

Hmmmm,

That's a tough one then. You could be losing packets... Someone could be
trying to infiltrate your system by messing with form data posted to it...
There are so many things this could be I don't even know where to begin.

You say 90% of the time the application is fine. Is that an exact figure? If
this is happening on 10% of all post backs I would certainly investigate it
further that's a very high number. But if it's really a lot less than that
then you may not need to worry about it at all...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
sjl said:
Justin. Thanks for the reply, unfortunately, I'm told by my host:

"Your site is being hosted on one of our shared servers which is not a
clustered environment. Only our webfarm servers are in a clustered
environment, which your site is not on."

Any other ideas?

SJL


S. Justin Gengo said:
sjl,

You should inquire of your webhost as to whether they are hosting via a
clustered environment. As the error states if they are you will need the
<machineKey> edited for the clusted environment.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
sjl said:
I've got an .aspx webform for searching my database. It basically takes
user input and passes it as a parm into a stored proc to search a table.
The results are returned in a SQLDataReader and bound to a datagrid on
the same page. It works 90% of the time as expected. However, for some
unknown reason, I randomly get the error below. The HttpException says
there is an 'Invalid_Viewstate'. Ok, but why? I'm posting back to the
same page. If the Viewstate is corrupt, then why?

I'm hosting at Orcs Web using shared hosting, ASP.NET 1.1, SQL 2000,
VS2003.

***********ERROR MESSAGE DETAILS******************
Unable to validate data.
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.

Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60

[HttpException (0x80004005): Authentication of viewstate failed. 1) If
this is a cluster, edit <machineKey> configuration so all servers use
the same validationKey and validation algorithm. AutoGenerate cannot be
used in a cluster. 2) Viewstate can only be posted back to the same
page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102

[HttpException (0x80004005): Invalid_Viewstate
Client IP: xxxxxx
Port: 3639
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50215)
ViewState: dDwtMTUxMTMzMDAzMjt0 [clipped]
Http-Referer: http://xxxxxxxxxx/search.aspx
Path: /search.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
***********ERROR MESSAGE DETAILS******************

Thanks for any help you can provide.
SJL
 
S

sjl

Thanks, Justin. After working through this with my host, they suggested two
things:

(a) move my site to a new appPool (same server, just a different appPool),
and
(b) add a machineKey value to my web.config.

Doing these two things appears to have corrected the problem. I believe the
problem is now resolved. Thanks for your suggestions.

SJL

S. Justin Gengo said:
Hmmmm,

That's a tough one then. You could be losing packets... Someone could be
trying to infiltrate your system by messing with form data posted to it...
There are so many things this could be I don't even know where to begin.

You say 90% of the time the application is fine. Is that an exact figure?
If this is happening on 10% of all post backs I would certainly
investigate it further that's a very high number. But if it's really a lot
less than that then you may not need to worry about it at all...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
sjl said:
Justin. Thanks for the reply, unfortunately, I'm told by my host:

"Your site is being hosted on one of our shared servers which is not a
clustered environment. Only our webfarm servers are in a clustered
environment, which your site is not on."

Any other ideas?

SJL


S. Justin Gengo said:
sjl,

You should inquire of your webhost as to whether they are hosting via a
clustered environment. As the error states if they are you will need the
<machineKey> edited for the clusted environment.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
I've got an .aspx webform for searching my database. It basically takes
user input and passes it as a parm into a stored proc to search a
table. The results are returned in a SQLDataReader and bound to a
datagrid on the same page. It works 90% of the time as expected.
However, for some unknown reason, I randomly get the error below. The
HttpException says there is an 'Invalid_Viewstate'. Ok, but why? I'm
posting back to the same page. If the Viewstate is corrupt, then why?

I'm hosting at Orcs Web using shared hosting, ASP.NET 1.1, SQL 2000,
VS2003.

***********ERROR MESSAGE DETAILS******************
Unable to validate data.
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.

Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[]
modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60

[HttpException (0x80004005): Authentication of viewstate failed. 1) If
this is a cluster, edit <machineKey> configuration so all servers use
the same validationKey and validation algorithm. AutoGenerate cannot
be used in a cluster. 2) Viewstate can only be posted back to the same
page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102

[HttpException (0x80004005): Invalid_Viewstate
Client IP: xxxxxx
Port: 3639
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.1.4322; .NET CLR 2.0.50215)
ViewState: dDwtMTUxMTMzMDAzMjt0 [clipped]
Http-Referer: http://xxxxxxxxxx/search.aspx
Path: /search.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
***********ERROR MESSAGE DETAILS******************

Thanks for any help you can provide.
SJL
 
S

S. Justin Gengo

sjl,

I'm glad you've figured it out!

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
sjl said:
Thanks, Justin. After working through this with my host, they suggested
two things:

(a) move my site to a new appPool (same server, just a different appPool),
and
(b) add a machineKey value to my web.config.

Doing these two things appears to have corrected the problem. I believe
the problem is now resolved. Thanks for your suggestions.

SJL

S. Justin Gengo said:
Hmmmm,

That's a tough one then. You could be losing packets... Someone could be
trying to infiltrate your system by messing with form data posted to
it... There are so many things this could be I don't even know where to
begin.

You say 90% of the time the application is fine. Is that an exact figure?
If this is happening on 10% of all post backs I would certainly
investigate it further that's a very high number. But if it's really a
lot less than that then you may not need to worry about it at all...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
sjl said:
Justin. Thanks for the reply, unfortunately, I'm told by my host:

"Your site is being hosted on one of our shared servers which is not a
clustered environment. Only our webfarm servers are in a clustered
environment, which your site is not on."

Any other ideas?

SJL


message sjl,

You should inquire of your webhost as to whether they are hosting via a
clustered environment. As the error states if they are you will need
the <machineKey> edited for the clusted environment.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
I've got an .aspx webform for searching my database. It basically
takes user input and passes it as a parm into a stored proc to search
a table. The results are returned in a SQLDataReader and bound to a
datagrid on the same page. It works 90% of the time as expected.
However, for some unknown reason, I randomly get the error below. The
HttpException says there is an 'Invalid_Viewstate'. Ok, but why? I'm
posting back to the same page. If the Viewstate is corrupt, then why?

I'm hosting at Orcs Web using shared hosting, ASP.NET 1.1, SQL 2000,
VS2003.

***********ERROR MESSAGE DETAILS******************
Unable to validate data.
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.

Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf,
Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60

[HttpException (0x80004005): Authentication of viewstate failed. 1)
If this is a cluster, edit <machineKey> configuration so all servers
use the same validationKey and validation algorithm. AutoGenerate
cannot be used in a cluster. 2) Viewstate can only be posted back to
the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102

[HttpException (0x80004005): Invalid_Viewstate
Client IP: xxxxxx
Port: 3639
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.1.4322; .NET CLR 2.0.50215)
ViewState: dDwtMTUxMTMzMDAzMjt0 [clipped]
Http-Referer: http://xxxxxxxxxx/search.aspx
Path: /search.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
***********ERROR MESSAGE DETAILS******************

Thanks for any help you can provide.
SJL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top