IIS 7 and Above
Known Issues and Workarounds
Visual Studio 2015 - Unable to validate data error
Last post Mar 30, 2018 08:29 AM by Yuk Ding
Mar 20, 2018 10:23 AM|sujanchristo|LINK
We are having a Web Project using machinekey in validation and works very fine in Visual Studio 2010.
But the same source is failing when ran from Visual Studio 2015. The error which we are getting is:
System.Web.HttpException was unhandled by user code
Message=Unable to validate data.
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte buf, Byte modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo, Boolean useLegacyMode, IVType ivType, Boolean signData)
at System.Web.Security.MembershipAdapter.EncryptOrDecryptData(Boolean encrypt, Byte buffer, Boolean useLegacyMode)
at System.Web.Security.MembershipProvider.DecryptPassword(Byte encodedPassword)
at System.Web.Security.SqlMembershipProvider.UnEncodePassword(String pass, Int32 passwordFormat)
at System.Web.Security.SqlMembershipProvider.GetPassword(String username, String passwordAnswer)
We could not find any solution related to this in any of the groups.
I suspect this to be something related to the IIS Express version / configuration on which the Website runs when executed from Visual Studio 2010 and Visual Studio 2015.
Any help on this would be greatly appreciated!
WIth Warm Regards,
Mar 21, 2018 02:15 AM|Yuk Ding|LINK
Did you specify something with machine key encryption/decryption key in web.config file or hard code in your application? I think maybe something is encrypted by the encryption key in visual studio 2010. When you migrate the project to 2015, the application
use the wrong decryption key which cause the failure of the decryption. So please specify the machinekey section in your web.config like this
<machineKey validationKey="3FF1E929BC0534950B0920A7B59FA698BD02DFE8" decryptionKey="280450BB36319B474C996B506A95AEDF9B51211B1D2B7A77" decryption="3DES" validation="SHA1"/>
Mar 21, 2018 07:48 AM|sujanchristo|LINK
Hi Yuk Ding,
Thanks a lot for the reply.
We are having the machine key in web.config file only. So do you think that regenerating the machine key be of help?
If so, is there a need or way to generate it through the IIS Express, which I could not find in it's settings?
Thanks for your time!
Mar 30, 2018 08:29 AM|Yuk Ding|LINK
I think regenerate machinekey may help. In addition, this link provide some other solutions for this issue.