How to download file (from a SSL web) that requires login id to the page using vb.net
koh
Junior Poster in Training
73 posts since Jul 2004
Reputation Points: 11
Solved Threads: 0
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
>i want to download a file from a SSL web to my local(C:\)
Think about WebRequest class. Read sknake's post - http://www.daniweb.com/forums/thread203253.html
Thanks for your reply :D
but im using webrequest class as welll....
but it doesnt seems working....
i compared the code as described and my code..
about the same.
Is there something need to be done on the login session?
anyway, here is my code,
thanks :D
Dim wr As HttpWebRequest
Dim ws As HttpWebResponse
Dim str As Stream
Dim inBuf(1000000) As Byte
Dim bytesToRead As Integer = CInt(inBuf.Length)
Dim bytesRead As Integer = 0
Dim request
request = WebRequest.Create(sRemoteUrl)
wr = CType(request, HttpWebRequest)
ws = CType(wr.GetResponse(), HttpWebResponse)
str = ws.GetResponseStream()
While bytesToRead > 0
Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
If n = 0 Then
Exit While
End If
bytesRead += n
bytesToRead -= n
End While
Dim fstr As New FileStream(sFile, FileMode.OpenOrCreate, FileAccess.Write)
fstr.Write(inBuf, 0, bytesRead)
str.Close()
fstr.Close()
koh
Junior Poster in Training
73 posts since Jul 2004
Reputation Points: 11
Solved Threads: 0
>Is there something need to be done on the login session?
Read MSDN FAQ .
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
Thanks for your guys' url/article.
The only missing is the cookie session.
Really appreciate your guy's assistance :D
koh
Junior Poster in Training
73 posts since Jul 2004
Reputation Points: 11
Solved Threads: 0