I use this code to upload file to server.
Dim clsRequest As System.Net.FtpWebRequest = _
DirectCast(System.Net.WebRequest.Create(a), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential(username, pwd)
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes(pdfPath)
' upload file...
Dim clsStream As System.IO.Stream = _
clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
But is show error unable to connect to remote server at line Dim clsStream As System.IO.Stream = _ clsRequest.GetRequestStream(). Any wrong?