System.Security.Cryptography.CryptographicException: Keyset does not exist. at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle) at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair() at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey() at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey()
<code>My Code is This : protected void SecureLoginButtonClick(object sender, EventArgs e) { string action = Request.QueryString[WSFederationConstants.Parameters.Action]; try { if (action == WSFederationConstants.Actions.SignIn) { // Process signin request. SignInRequestMessage requestMessage = (SignInRequestMessage)WSFederationMessage.CreateFromUri(Request.Url); if (WebHelper.IsAuthenticatedUser) { SecurityTokenService sts = new CustomSecurityTokenService(CustomSecurityTokenServiceConfiguration.Current); SignInResponseMessage responseMessage = FederatedPassiveSecurityTokenServiceOperations.ProcessSignInRequest(requestMessage, User, sts); FederatedPassiveSecurityTokenServiceOperations.ProcessSignInResponse(responseMessage, Response); } else { throw new UnauthorizedAccessException(); } } else { Response.Redirect("~/" + Constants.LoginPageName + SessionInfo.RedirectUrl); } } catch (UnauthorizedAccessException exception) { Errorlog.AddException(exception.ToString()); Response.Redirect("~/" + Constants.LoginPageName + SessionInfo.RedirectUrl); } catch (ThreadAbortException ex) { } catch (Exception exception) { Errorlog.AddException(exception.ToString()); throw; } }</code>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)