October 1st, 2011, 09:57 PM
FTP Upload with FTP Account
Currently have a code that uploads an .xml file to my server. However, this code only works if I use my cPanel credentials. I think it would be easier, and much safer, if possible, to be able to connect via an ftp account. Any suggestions?
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.myserver.com), System.Net.FtpWebRequest) request.Credentials = New System.Net.NetworkCredential("cpaneluser", "cpanelpass") request.Method = System.Net.WebRequestMethods.Ftp.UploadFile Dim file() As Byte = System.IO.File.ReadAllBytes(path) Dim strr As System.IO.Stream = request.GetRequestStream() strr.Write(file, 0, file.Length) strr.Close() strr.Dispose()
October 2nd, 2011, 12:53 AM
Back in the VB6 days there was an Inet control that gave you ftp support from your code. There must be something similar in NET, try searching for ftp vb controls
The command-line ftp program can be called from code. For security though, I'd want to use ftps or some other secure transfer, basic ftp is not secure.
The man who doesn't read good books has no advantage over the man who can't read them.
December 8th, 2011, 04:22 AM
the black arts
the easiest way is to make a batch file and use some of the black arts available since the beginning of time..
Originally Posted by Feartheyankees
your windows system has been able to ftp sinc it was dos
you can use all the old dos commands to traverse a site and send or indeed retrieve files in both ascii and binary format. you can even read the settings from a plain text file..
if You want to try this please ask
Bill Stewart - here to talk