Using pfx certificate to authenticate a webrequest
i need to get some info from a website page that requires an
Ive got the provided certificate installed in IE, and when accessing
the website page, it shows a window to select the client certificate
and then shows the page correctly.
Im trying to do this by code (vs2003 C# aspnet), using webrequest.
The certificate is in an pfx file and does not require password. I've
exported the file using IE to DER encoded binary X.509 (.cer), since
its the only format used by .net webrequest certificates (?)
X509Certificate certificate =
HttpWebRequest req =
// here goes the request response read
I got this error:
System.Net.WebException: The underlying connection was closed: Could
not establish secure channel for SSL/TLS. --->
System.ComponentModel.Win32Exception: The message received was
unexpected or badly formatted at
System.Net.TlsStream.EndRead(IAsyncResult asyncResult) at
System.Net.Connection.ReadCallback(IAsyncResult asyncResult) --- End
of inner exception stack trace --- at
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at
From the error i can see that the certificate is invalid, because if i
dont use the certificate i get the same error messagem.
So... anyone knows how or point me to the right path to do a request
from an https website, using an pfx file?
Re: Using pfx certificate to authenticate a webrequest
dont understand why nobody ever answer my questions about using
certificates in aspnet (this is not my first post about this).
Well, ive solved my problem. I had an pfx certificate installed and
exported to x509 format. Using webrequest and the exported certificate
i was getting an error accessing the website (https)
The problem was because my ASPNET account didnt have the rights to
access installed certificate.
I had to use a microsoft tool (winhttpcertcfg) to give access to
Know all works...
Hope this will help anyone who has the same problem...
help on accessing https website
How do you download the certficate..where to find the .cer file?
can you please send me the code for same.
thanks in advance.
Hi Nelson R., I want thank you for your reply... this have help me a lot!!!
Me too, I have not found relevant help on google or forum in web... :(
I have not solved my problem completly, but I have seen a way to solve grace your response!!
Have a nice day!!
|All times are GMT. The time now is 04:35 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.