My.Computer.Network namespace provides the DownloadFile method which can be used for downloading a remote file to a specific location.
The basic syntax for calling DownloadFile method is to specify the file's location as a string or URI and the location to store the file as seen below:
My.Computer.Network.DownloadFile("http://www.server.com/readme.txt", "c:\docs\readme.txt")
The overloaded methods allow you to specify more advanced parameter like timeout, username & password for protected file. The example below downloads password protected file.
My.Computer.Network.DownloadFile("http://www.server.com/readme.txt", "c:\docs\readme.txt", "myusername", "mypassword")
Note that FTP protocol is used by the DownloadFile method to send information including username & password in plain text. It should not be used to transmit sensitive information.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment