Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Decrypt the cookie #2

Open
nitinjs opened this issue Jun 2, 2018 · 4 comments
Open

Unable to Decrypt the cookie #2

nitinjs opened this issue Jun 2, 2018 · 4 comments

Comments

@nitinjs
Copy link

nitinjs commented Jun 2, 2018

Hi,

I am getting following issue while decrypting:

An exception of type 'System.Web.HttpException' occurred in HttpCookieEncryption.dll but was not handled in user code

Additional information: Unable to Decrypt the cookie.

@nitinjs
Copy link
Author

nitinjs commented Jun 2, 2018

Inner exception says

Could not find any recognizable digits.

@ericnewton76
Copy link
Owner

ericnewton76 commented Jun 4, 2018 via email

@ericnewton76
Copy link
Owner

If you're using a webfarm (ie, multiple web servers load balanced) then make sure the machineKey is the same for all the webservers.

This library utilizes the same ASP.Net WebForms encryption/decryption mechanisms that protect ViewState. (Also if you change machineKey in between requests).

That could be why it can't decrypt.

@juanzeta33
Copy link

Hi, I was having same problem, I was investigating and I found this issue open since 2018, just to be solved, what I did was remove the first two segments of the generated hex and with that if it performed the decryption correctly.

string hex = string.Join(string.Empty, oldHex.Skip(2)); on HexStringToByteArray function in MachineKeyWrapper Class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants