| 
            
              | by Hans Jörgensen posted on 2003/11/11
 |  |  Hi,
 I met problems when I impersonate the ASP.NET application with a row in a web.config:
 
 <identity impersonate="true" />
 
 This should impersonate the application to logged user account that is administrator in this case.
 
 
 If I do this I cant instantiate a Certficate object so that the public key wouldn't be invalid or un touchable. In debugger I see that the PublicKey property has rised an exception.
 
 If I don't impersonate the application, everything goes fine.
 
 What can cause this situation ? Does anybody have a clue ?
 
 my code:
 
 Certificate RSAcert = Certificate.CreateFromCerFile("C:\\client.cer");
 RSAcert.AssociateWithPrivateKey("C:\\client.pvk", "test", true);
 Debug.WriteLine("pub key: "+RSAcert.GetPublicKeyString()); // this gives always a nice public key string
 RSAPKCS1SignatureDeformatter RSADeformatter = new RSAPKCS1SignatureDeformatter(RSAcert.PublicKey); // this makes things to hang
 
 |