When I run the app, it compiles fine without problems, but before showing me the index I have, it gives me a screenshot of an error:
Server error in application '/'. Error during a cryptographic operation. Description: Unhandled exception executing the current web request. Review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Cryptography.CryptographicException: Error during a cryptographic operation.
Source code error:
Line 26: Cache = db.UserTokenCacheList.FirstOrDefault(c => c.webUserUniqueId == userId); Line 27: // place the entry in memory Line 28: this.Deserialize((Cache == null) ? null : MachineKey.Unprotect(Cache.cacheBits,"ADALCache")); Line 29: } Line 30:
And the code in which I get an error.
public ADALTokenCache(string signedInUserId)
{
// associate the cache to the current user of the web app
userId = signedInUserId;
this.AfterAccess = AfterAccessNotification;
this.BeforeAccess = BeforeAccessNotification;
this.BeforeWrite = BeforeWriteNotification;
// look up the entry in the database
Cache = db.UserTokenCacheList.FirstOrDefault(c => c.webUserUniqueId == userId);
// place the entry in memory
this.Deserialize((Cache == null) ? null : MachineKey.Unprotect(Cache.cacheBits,"ADALCache"));
}
It is in the part of this.Deserialize
After "playing with it" for over a few hours, I went into the database I have and deleted all the rows from the UserTokenCaches table. I ran the app, got over the crypto error message. A new cache token record was created and inserted into the table.