locked
FTP for ASP.net 4.0 RRS feed

  • Question

  • User1316246260 posted

    I am using .NET and ASP.net 4.0.

    I am trying to download a file from my web server according to MSDN:

    http://msdn.microsoft.com/en-us/library/ms229711%28v=vs.100%29.aspx

    But other sites differ in NetworkCredential.

    Can someone troubleshoot this progam so I can get it to work.

    Sub ftp
            Dim request As FtpWebRequest = DirectCast(WebRequest.Create("ftp://ftp.mysite.com/ftp1/"), FtpWebRequest)
            request.Method = WebRequestMethods.Ftp.DownloadFile
            request.Credentials = New NetworkCredential("ftp721234, "password")
            Dim response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)
            Dim responseStream As Stream = response.GetResponseStream()
            Dim reader As New StreamReader(responseStream)
            Console.WriteLine(reader.ReadToEnd())
            Console.WriteLine("Download Complete, status {0}", response.StatusDescription)
            reader.Close()
            response.Close()
    End sub

    Friday, May 10, 2013 4:25 AM

Answers

All replies