ANSWERS: 1
  • Existing code Public Sub ftp(ByVal ftplocation As String, ByVal user As String, ByVal pass As String, ByVal data As String) Dim callback As AsyncCallback Dim state As Object Dim returnValue As IAsyncResult Dim client As System.Net.FtpWebRequest = System.Net.FtpWebRequest.Create(ftplocation) 'Dim reqstream As System.IO.Stream = client.GetRequestStream() Dim chararray As Char() = data.ToCharArray Dim writebuffer(data.Length) As Byte Dim ftpresponse As System.Net.FtpWebResponse client.Credentials = New System.Net.NetworkCredential(user, pass) client.Method = System.Net.WebRequestMethods.Ftp.UploadFile client.GetRequestStream.Write(writebuffer, 0, writebuffer.Length) returnValue = client.BeginGetRequestStream(callback, state) For i = 0 To chararray.Length - 1 writebuffer(i) = Asc(chararray(i)) Next i 'reqstream.Write(writebuffer, 0, writebuffer.Length) Do While returnValue.IsCompleted() = False Loop client.EndGetRequestStream(returnValue) ftpresponse = client.GetResponse() Console.WriteLine(ftpresponse.BannerMessage) Console.WriteLine("Authenticated Successfully = " & ftpresponse.IsMutuallyAuthenticated) If ftpresponse.IsMutuallyAuthenticated Then Console.WriteLine(ftpresponse.WelcomeMessage) Else Console.WriteLine(ftpresponse.StatusCode & " - " & ftpresponse.StatusDescription) End If End Sub

Copyright 2018, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy