WebClient下载文件代码!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim S() As String = Split(TextBox1.Text, "/")
        Dim Filename As String = S(UBound(S))
        Dim DownUrl As String = TextBox1.Text
        Dim myStringWebResource As String = DownUrl
        Dim myWebClient As New Net.WebClient
        Response.Write(Filename + "<br>")


        TextBox2.Text = "F:\" & Filename

        Response.Write(TextBox2.Text)
        'Response.End()

        myWebClient.DownloadFile(myStringWebResource, TextBox2.Text)
        Label1.Text = "下载成功!"


    End Sub

你可能感兴趣的:(client)