Hello, i need to upload a text that it's on a textbox to ftp,
I have this code
The application doesn't FC but it gives this on "Immediate Window" everytime it's supposed to send
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
I don't understand what's the problem...? Is there another way to send it to ftp or what?
I have this code
VB.NET:
Try
Dim sourceStream As New StreamReader(TextBox1.Text)
Dim fileContents As Byte() = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())
sourceStream.Close()
Dim Request As System.Net.FtpWebRequest = FtpWebRequest.Create("ftp://@ftp.drivehq.com/Important.txt")
Request.Credentials = New NetworkCredential("Username", "Password")
Request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Request.Proxy = Nothing
Request.KeepAlive = False
Request.GetRequestStream.Write(fileContents, 0, fileContents.Length)
Request.Abort()
Catch ex As Exception
End Try
The application doesn't FC but it gives this on "Immediate Window" everytime it's supposed to send
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
I don't understand what's the problem...? Is there another way to send it to ftp or what?