Hi, I am stuck on some code I have to upload a file to my FTP server. I keep getting an error: The remote name could not be resolved: 'ftp.mywebsite.com'
' set up request...
Dim clsRequest As System.Net.FtpWebRequest = _
DirectCast(System.Net.WebRequest.Create("ftp://ftp.mywebsite.com/test.txt"), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential("username", "password")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
OpenFileDialog1.ShowDialog()
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes(OpenFileDialog1.FileName)
' upload file...
Dim clsStream As System.IO.Stream = _
clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
I use File Zilla for uploading my files via FTP, in the Host Name box on File Zilla, I put my domain name.com, enter my username and password and login sucessfully...
However, when I try this on VB.NET (using the code above) I keep getting this error... Any help as to why this might be happening?
Many Thanks