I have a code for downloading file from HTTPS
Dim URI As String = "https://secure.ddcos.com/MOVEitISAPI/MOVEitISAPI.310/action=hu_downld!parm=e930810185440778334!NoAttach=1/98677_5050854223051_942963.jpg"
Dim oRequest As System.Net.HttpWebRequest = CType(HttpWebRequest.Create(URI), HttpWebRequest)
oRequest.Credentials = New System.Net.NetworkCredential("username", "password")
Using oResponse As System.Net.WebResponse = CType(oRequest.GetResponse, System.Net.WebResponse)
Using responseStream As IO.Stream = oResponse.GetResponseStream
Using fs As New IO.FileStream("D:\98677_5050854223051_942963.jpg", FileMode.Create, FileAccess.Write)
Dim buffer(2047) As Byte
Dim read As Integer
Do
read = responseStream.Read(buffer, 0, buffer.Length)
fs.Write(buffer, 0, read)
Loop Until read = 0
responseStream.Close()
fs.Flush()
fs.Close()
End Using
responseStream.Close()
End Using
oResponse.Close()
End Using
MsgBox("done")
I can create a file but it has no data(0 byte) size, don't know why that happen
But when I use this site,
Dim URI As String = "https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"
oRequest.Credentials = New System.Net.NetworkCredential("", "")
I can download the file successfully,
So what's wrong with the above code? Any suggestion appreciated.
Thanks. . .
Revision:
I found something in the Internet, I don't know if this is correct.
ClientCertificate Collection[
^]
To access to the
Web Server(https), a
Client Browser must send/have a
ClientCertificate, so if that's the case how can I have a
ClientCertificate?