I have implemented a https HttpWebResponse in .Net 3.5 as follow.
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("https://someDomain.com");
System.Net.ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidation;
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.Stream responseStream = response.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(responseStream);
string responseData = reader.ReadToEnd();
public bool RemoteCertificateValidation(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
Now the problem is when ever it wants to read from the created URL (request.GetResponse();
) it throws the following exception:
"The underlying connection was closed: An unexpected error occurred on a receive."
I have searched and found out there are some method in .Net 1.1 which you have to download certificate and add a reference to that. Also have to implement the ICertificatePolic
View Complete Post