rahulnarawade
New member
- Joined
- Jan 5, 2010
- Messages
- 1
- Programming Experience
- 1-3
Hello All,
I am trying to download a file from a website over SSL. Below is the code snippet. This website prompts for a certificate. I am adding the certificate to the request object from a .cer file. Wondering what is the problem. Also tried skipping the certificate using the interface Icertificate policy.
Exception is :-
System.Net.WebException: The underlying connection was closed: Could
not establish secure channel for SSL/TLS. ---System.Net.WebException:
The request was aborted: The connection was closed unexpectedly.
Dim Req As HttpWebRequest =
WebRequest.Create("https://10.217.65.195:8004/status.xml")
Response.Write("3")
Req.Method = "POST"
Req.AllowAutoRedirect = True
Req.Proxy = System.Net.WebProxy.GetDefaultProxy()
Req.Timeout = 100000
Req.ProtocolVersion = HttpVersion.Version11
Req.ContentType = "text/xml"
Req.KeepAlive = False
postdata = ""
Req.ContentLength = postdata.Length
Req.AllowWriteStreamBuffering = True
Dim result As String
Dim objResponse As HttpWebResponse = Req.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd
Response.Write(result)
sr.Close()
I am trying to download a file from a website over SSL. Below is the code snippet. This website prompts for a certificate. I am adding the certificate to the request object from a .cer file. Wondering what is the problem. Also tried skipping the certificate using the interface Icertificate policy.
Exception is :-
System.Net.WebException: The underlying connection was closed: Could
not establish secure channel for SSL/TLS. ---System.Net.WebException:
The request was aborted: The connection was closed unexpectedly.
Dim Req As HttpWebRequest =
WebRequest.Create("https://10.217.65.195:8004/status.xml")
Response.Write("3")
Req.Method = "POST"
Req.AllowAutoRedirect = True
Req.Proxy = System.Net.WebProxy.GetDefaultProxy()
Req.Timeout = 100000
Req.ProtocolVersion = HttpVersion.Version11
Req.ContentType = "text/xml"
Req.KeepAlive = False
postdata = ""
Req.ContentLength = postdata.Length
Req.AllowWriteStreamBuffering = True
Dim result As String
Dim objResponse As HttpWebResponse = Req.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd
Response.Write(result)
sr.Close()