|
Hello, To perform a proper authentication with our customer we installed a certificate on our server. When i am trying to read the certificate before sending it i get the "System.Security.Cryptography.CryptographicException: Access is denied." exception. I believe that this is somehow connected to the permissions of the web application we are using. I validated twice that the "trust" element is set to "FULL" (in the web.config and the web application configuration in IIS). Is there other permissions i have to set to allow the web application to access and read the certificate? Some folder permissions? The code I am using is: X509Certificate2 selectedCertificate = null; try { X509Store xStroe = new X509Store(StoreName.My, StoreLocation.CurrentUser); xStroe.Open(OpenFlags.ReadWrite); foreach (X509Certificate2 certificate in xStroe.Certificates) { if (certificate.Subject.Equals("CN=" + _USERNAME)) { selectedCertificate = certificate; break; } } } catch (Exception ex) { selectedCertificate = null; } return selectedCertificate; } Thanks, Mike |