
Originally Posted by
kleinma
what more do you need?
1) download and open up the my example code
2) go into the class file called WebFileDownloader
3) find the routine called DownloadFileWithProgress
4) find the line of code mentioned above
wRemote = WebRequest.Create(URL)
5) insert this code after it
wRemote.Credentials = New Net.NetworkCredential("USERNAME", "PASSWORD")
6) change USERNAME and PASSWORD to actual valid values
7) test code against site that needs authentication
Its not working i have try it just now
Code:
FS = New FileStream(Location, FileMode.Create, FileAccess.Write)
wRemote = WebRequest.Create(URL)
wRemote.Credentials = New Net.NetworkCredential("myname", "mypass")
Dim myWebResponse As WebResponse = wRemote.GetResponse
RaiseEvent FileDownloadSizeObtained(myWebResponse.ContentLength)
Dim sChunks As Stream = myWebResponse.GetResponseStream
Do
iBytesRead = sChunks.Read(bBuffer, 0, 256)
FS.Write(bBuffer, 0, iBytesRead)
iTotalBytesRead += iBytesRead
If myWebResponse.ContentLength < iTotalBytesRead Then
RaiseEvent AmountDownloadedChanged(myWebResponse.ContentLength)
Else
Can you check it for me pls?
EDIT : Its download only 5 Kb from 100 MB....