Tuesday, May 31, 2016

Error occurred during a cryptographic operation. 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.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.

Server Error in '/' Application.

Error occurred during a cryptographic operation.

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.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.

Source Error:


Line 53:                     //var prin = new GenericPrincipal(id, userRoles);
Line 54:                     //HttpContext.Current.User = prin;
Line 55:                     var ticket = FormsAuthentication.Decrypt(encTicket);
Line 56:                     var id = new UserIdentity(ticket);
Line 57:                     string[] userRoles = { "A" };


Source File: c:\Naresh\                                        Global.asax.cs    Line: 55

Stack Trace:


[CryptographicException: Error occurred during a cryptographic operation.]
   System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Homogen
izeErrors(Func`2 func, Byte[] input) +115
   System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Unprot
ect(Byte[] protectedData) +70
   System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket)
 +9692626
   CanPayApp.MvcApplication.MvcApplication_PostAuthenticateRequest(Object
 sender, EventArgs e) in c:\Naresh\05 31 2016\CanPayApp\CanPayApp\Global
.asax.cs:55
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecut
ionStep.Execute() +141
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
 completedSynchronously) +69



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0

=============================================================================
=Cleanup code and open... 

For anyone who hasn't solved their problem, I was missing the "machineKey" entry for encrypt/decrypt in my web.config

=
Try clearing your cache and cookies in order to mitigate the error. I suspect some sort of error occurred when information was sent to or from the server.

Friday, May 13, 2016

The localhost page isn’t working in visual studio

Resolved::: solution> project properties> change iis express port number ----