.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > Trust Level Issue?
 

Trust Level Issue?

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
LiberMike
Found the problem after reading this post: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/67216e79-c259-4685-95d0-3a09bab5c0c5 It appears that i installed the certificate under Administrator user and my Application pool user was completely different user. In order for the code to work i had to login to the server with my Application pool user and install the certificate under this user. Stupid me.
LiberMike

You can use google to search for other answers

Custom Search

More Threads

• Remoting....Delegates....
• WCF (Indigo)
• Security questions
• Soapsuds.exe error
• How to convert config file settings to programmatic settings
• DataSet serialization problem through remoting (VS2005 release)
• Problem in Remoting Performance.
• Bad SSPI performance on Vista
• A problem in transffering data on a cross platform
• Locked port when server is closed when a client is connected.