Results 1 to 3 of 3

Thread: webclient

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    webclient

    Hi everyone.
    My webclient code works fine for downloading a single file from a website.
    But now I would like to download two or as many as there are files on the website. This gives an error as follows, although it still downloads the second file too.?:
    The error is: An unhandled exception of type 'system.net.webexception occured in system.dll'
    'Additional information: The remote server returned an error (404) not found'

    Thank you

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    i answered on the dotnet forum , but here ya go :
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim client(1) As Net.WebClient
    3.         Dim strUrls() As String = {"http://www.dotnetforums.net/images/blue/on.gif", "http://www.dotnetforums.net/images/smilies/mad.gif"}
    4.         Dim strPath() As String = {"D:\im1.gif", "D:\im2.gif"}
    5.         Dim x As Integer
    6.  
    7.         For x = 0 To 1
    8.             client(x) = New Net.WebClient()
    9.             client(x).DownloadFile(strUrls(x), strPath(x))
    10.             client(x).Dispose()
    11.         Next
    12.  
    13.     End Sub
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678
    is ftp better than using webclient?
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width