Unable to validate data - CSharp
This is a discussion on Unable to validate data - CSharp ; I have come across this error. I have found a solution to it but am
unsure what it does. (solution at the bottom)
***************************************************************************<code>
Unable to validate data.
Description: An unhandled exception occurred during the execution of
the current web ...
-
Unable to validate data
I have come across this error. I have found a solution to it but am
unsure what it does. (solution at the bottom)
***************************************************************************<code>
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.
Exception Details: System.Web.HttpException: Unable to validate data.
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): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf,
Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)
System.Web.UI.LosFormatter.Deserialize(String input)
[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)
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
[HttpException (0x80004005): Invalid_Viewstate
Client IP: 127.0.0.1
Port: 3391
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
ViewState:
dDwxMDAwMTQ5NDg5O3Q8O2w8aTwxPjs+O2w8dDw7bDxpPDE1PjtpPDE2PjtpPDE3PjtpPDE4PjtpPDIwPjtpPDIyPjtpPDI0PjtpPDI2PjtpPDI4PjtpPDMwPjtpPDMyPjtpPDM0PjtpPDM2PjtpPDM4PjtpPDQwPjs+O2w8dDxwPHA8bDxUZXh0O1Zpc2libGU7PjtsPFNNQiBRdW90ZSBCdWlsZGVyO288Zj47Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7VmlzaWJsZTs+O2w8V2FybmluZztv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cPg0KICAgICAgICAgICAgXDxCXD5RdW90ZSBOdW1iZXI6XDwvQlw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICAgIFw8VEQgYWxpZ249ImNlbnRlciIgY29sU3Bhbj0iMiJcPg0KICAgICAgICAgICAgXDxCXD5RVU8xMjM0NVw8L0JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgXDwvVFJcPg0KICAgICAgICBcPFRSXD4NCiAgICAgICAgICBcPFREIGNsYXNzPSJ0YWJsZWhlYWQiXD4NCiAgICAgICAgICAgIFw8Qlw+UGFydAlOdW1iZXJcPC9CXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgICAgXDxURCBjbGFzcz0idGFibGVoZWFkIiBzdHlsZT0iV0lEVEg6CTM1MHB4Ilw+DQogICAgICAgICAgICBcPEJcPkRlc2NyaXB0aW9uXDwvQlw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICAgIFw8VEQgY2xhc3M9InRhYmxlaGVhZCJcPg0KICAgICAgICAgICAgXDxCXD5RdWFudGl0eVw8L0JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgICBcPFREIGNsYXNzPSJ0YWJsZWhlYWQiXD4NCiAgICAgICAgICAgIFw8Qlw+VW5pdAlQcmljZVw8L0JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgICBcPFREIGNsYXNzPSJ0YWJsZWhlYWQiXD4NCiAgICAgICAgICAgIFw8Qlw+VG90YWwgUHJpY2VcPC9CXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgIFw8L1RSXD4NCiAgICAgICAgXDxUUlw+DQogICAgICAgICAgXDxURFw+QkNNXDwvVERcPg0KICAgICAgICAgIFw8VERcPkJDTTUwXDwvVERcPg0KICAgICAgICAgIFw8VERcPjFcPC9URFw+DQogICAgICAgICAgXDxURFw+NTBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgICBcPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiXD4NCgkJCQkJCQlkb2N1bWVudC53cml0ZShtdWx0aXBseSgxLDUwKSkNCgkJCQkJCVw8L3NjcmlwdFw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICBcPC9UUlw+DQogICAgICAgIFw8VFJcPg0KICAgICAgICAgIFw8VERcPk5UXDwvVERcPg0KICAgICAgICAgIFw8VERcPk5UNjAwODhcPC9URFw+DQogICAgICAgICAgXDxURFw+NFw8L1REXD4NCiAgICAgICAgICBcPFREXD41MDBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgICBcPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiXD4NCgkJCQkJCQlkb2N1bWVudC53cml0ZShtdWx0aXBseSg0LDUwMCkpDQoJCQkJCQlcPC9zY3JpcHRcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgXDwvVFJcPg0KICAgICAgICBcPFRSXD4NCiAgICAgICAgICBcPFREXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICAgIFw8VERcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgICBcPFREXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgICBcPGJcPg0KICAgICAgICAgICAgICBcPHVcPg0KICAgICAgICAgICAgICAgIFw8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCJcPmRvY3VtZW50LndyaXRlKGdldEdyYW5kVG90YWwoKSlcPC9zY3JpcHRcPg0KICAgICAgICAgICAgICBcPC91XD4NCiAgICAgICAgICAgIFw8L2JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgXDwvVFJcPg0KICAgICAgXDwvVEFCTEVcPg0KICAgIFw8L2Zvcm1cPg0KICBcPC9ib2R5XD4NClw8L0hUTUxcPjs+Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPFxlOz4+Oz47Oz47dDxwPHA8bDxUZXh0Oz47bDxcZTs+Pjs+Ozs+Oz4+Oz4+Oz5/A5uhT8gX1VFAsE8KoOybYZnQkg==
Http-Referer: http://localhost/SMBWeb/smbQuestionScreen.aspx
Path: /SMBWeb/smbQuotePage.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()
</code>************************************************************************************
Found a solution:
In web.config if I add the following lines under the tag <system.web>
<pages buffer="true" enableSessionState="true" enableViewState="true"
enableViewStateMac="false"/>
***********************************************************************************
I'm pretty new to all this .net coding and would really appreicate the
help. I am using session objects and hidden fields and they are being
transferred from smbQuestionScreen.aspx to smbQuotePage.aspx
The error itself I find isn't very descriptive.
Thanks for the attention.
-
Re: Unable to validate data
Hi there,
ASP.NET by default validates the viewstate to make sure it came from
the correct page. This is because the viewstate is vunerable to
tampering when data is sent between the server and the client.
MAC stands for message authentication code (also known as a checksum)
is generated by some authentication scheme to allow some user to verify
a message or data.
Your solution disables this authentication by setting the
Page.EnableViewStateMac property to false.
There is a lot of information on this subject on MSDN and Microsoft.com
These are the default settings for ASP.NET (in web.config)
<pages enableViewStateMac="true" viewStateEncryptionMode="Auto" ... />
<machineKey validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps"
validation="SHA1" decryption="Auto" />
rory.carroll wrote:
> I have come across this error. I have found a solution to it but am
> unsure what it does. (solution at the bottom)
>
>
> ***************************************************************************<code>
> 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.
>
> Exception Details: System.Web.HttpException: Unable to validate data.
>
> 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): Unable to validate data.]
> System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf,
> Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)
> System.Web.UI.LosFormatter.Deserialize(String input)
>
> [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)
> System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
>
> [HttpException (0x80004005): Invalid_Viewstate
> Client IP: 127.0.0.1
> Port: 3391
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
> CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
> ViewState:
> dDwxMDAwMTQ5NDg5O3Q8O2w8aTwxPjs+O2w8dDw7bDxpPDE1PjtpPDE2PjtpPDE3PjtpPDE4PjtpPDIwPjtpPDIyPjtpPDI0PjtpPDI2PjtpPDI4PjtpPDMwPjtpPDMyPjtpPDM0PjtpPDM2PjtpPDM4PjtpPDQwPjs+O2w8dDxwPHA8bDxUZXh0O1Zpc2libGU7PjtsPFNNQiBRdW90ZSBCdWlsZGVyO288Zj47Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7VmlzaWJsZTs+O2w8V2FybmluZztvPGY+Oz4+Oz47Oz47dDxwPHA8bDxUZXh0O1Zpc2libGU7PjtsPEVycm9yO288Zj47Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7VmlzaWJsZTs+O2w8UXVvdGUgU3VtbWFyeTtvPHQ+Oz4+Oz47Oz47dDxwPHA8bDxUZXh0Oz47bDxSZWxlYXNlIDEuMDs+Pjs+Ozs+O3Q8cDxwPGw8VGV4dDs+O2w8U3RlcDs+Pjs+Ozs+O3Q8cDxwPGw8VGV4dDs+O2w8NTs+Pjs+Ozs+O3Q8cDxwPGw8VGV4dDs+O2w8b2Y7Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPDU7Pj47Pjs7Pjt0PHA8cDxsPFRleH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kIiBzdHlsZT0iV0lEVEg6CTM1MHB4Ilw+DQogICAgICAgICAgICBcPEJcPkRlc2NyaXB0aW9uXDwvQlw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICAgIFw8VEQgY2xhc3M9InRhYmxlaGVhZCJcPg0KICAgICAgICAgICAgXDxCXD5RdWFudGl0eVw8L0JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgICBcPFREIGNsYXNzPSJ0YWJsZWhlYWQiXD4NCiAgICAgICAgICAgIFw8Qlw+VW5pdAlQcmljZVw8L0JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgICBcPFREIGNsYXNzPSJ0YWJsZWhlYWQiXD4NCiAgICAgICAgICAgIFw8Qlw+VG90YWwgUHJpY2VcPC9CXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgIFw8L1RSXD4NCiAgICAgICAgXDxUUlw+DQogICAgICAgICAgXDxURFw+QkNNXDwvVERcPg0KICAgICAgICAgIFw8VERcPkJDTTUwXDwvVERcPg0KICAgICAgICAgIFw8VERcPjFcPC9URFw+DQogICAgICAgICAgXDxURFw+NTBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgICBcPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiXD4NCgkJCQkJCQlkb2N1bWVudC53cml0ZShtdWx0aXBseSgxLDUwKSkNCgkJCQkJCVw8L3NjcmlwdFw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICBcPC9UUlw+DQogICAgICAgIFw8VFJcPg0KICAgICAgICAgIFw8VERcPk5UXDwvVERcPg0KICAgICAgICAgIFw8VERcPk5UNjAwODhcPC9URFw+DQogICAgICAgICAgXDxURFw+NFw8L1REXD4NCiAgICAgICAgICBcPFREXD41MDBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgICBcPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiXD4NCgkJCQkJCQlkb2N1bWVudC53cml0ZShtdWx0aXBseSg0LDUwMCkpDQoJCQkJCQlcPC9zY3JpcHRcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgXDwvVFJcPg0KICAgICAgICBcPFRSXD4NCiAgICAgICAgICBcPFREXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgXDwvVERcPg0KICAgICAgICAgIFw8VERcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgICBcPFREXD4NCiAgICAgICAgICBcPC9URFw+DQogICAgICAgICAgXDxURFw+DQogICAgICAgICAgICBcPGJcPg0KICAgICAgICAgICAgICBcPHVcPg0KICAgICAgICAgICAgICAgIFw8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCJcPmRvY3VtZW50LndyaXRlKGdldEdyYW5kVG90YWwoKSlcPC9zY3JpcHRcPg0KICAgICAgICAgICAgICBcPC91XD4NCiAgICAgICAgICAgIFw8L2JcPg0KICAgICAgICAgIFw8L1REXD4NCiAgICAgICAgXDwvVFJcPg0KICAgICAgXDwvVEFCTEVcPg0KICAgIFw8L2Zvcm1cPg0KICBcPC9ib2R5XD4NClw8L0hUTUxcPjs+Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPFxlOz4+Oz47Oz47dDxwPHA8bDxUZXh0Oz47bDxcZTs+Pjs+Ozs+Oz4+Oz4+Oz5/A5uhT8gX1VFAsE8KoOybYZnQkg==
> Http-Referer: http://localhost/SMBWeb/smbQuestionScreen.aspx
> Path: /SMBWeb/smbQuotePage.aspx.]
> System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
> System.Web.UI.Page.LoadPageViewState()
> System.Web.UI.Page.ProcessRequestMain()
>
> </code>************************************************************************************
>
> Found a solution:
>
> In web.config if I add the following lines under the tag <system.web>
>
> <pages buffer="true" enableSessionState="true" enableViewState="true"
> enableViewStateMac="false"/>
> ***********************************************************************************
>
> I'm pretty new to all this .net coding and would really appreicate the
> help. I am using session objects and hidden fields and they are being
> transferred from smbQuestionScreen.aspx to smbQuotePage.aspx
>
> The error itself I find isn't very descriptive.
>
> Thanks for the attention.
Similar Threads
-
By Application Development in forum DOTNET
Replies: 5
Last Post: 09-19-2007, 11:40 AM
-
By Application Development in forum Sharepoint
Replies: 0
Last Post: 10-24-2006, 01:43 PM
-
By Application Development in forum Sharepoint
Replies: 0
Last Post: 09-28-2006, 02:49 AM
-
By Application Development in forum XML SOAP
Replies: 1
Last Post: 08-20-2006, 03:56 AM
-
By Application Development in forum XML SOAP
Replies: 1
Last Post: 04-10-2006, 03:00 AM