# Tuesday, December 09, 2003

I'm making a web request to a site that uses certificate authentication, and it's the first time I've done that with .NET, so bear with me.  I'm doing something like the following...

HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://mysite.com");

X509Certificate x509 = X509Certificate.CreateFromCertFile(@"c:\temp\mycert.cer");


That works fine, but it seems like there should be an easier way.  The certificate already exists in my local certificate store, or I'm pretty sure this wouldn't work at all, so why do I have to export the cert to a .cer file in order to use it?  Shouldn't I be able to get a reference to it directly from the certificate store?  Or would that involve too much unmanaged yuckiness?  It just seems like an extra step, and administrative hassle, but maybe that's just the way it is. 

Any suggestions or feedback welcome.


Got it.