> ' FTP setup > loFtpWebRequest = System.Net.FtpWebRequest.Create(New Uri(lcURI)) > loFtpWebRequest.Credentials = New System.Net.NetworkCredential(cUsername, cPassword) > loFtpWebRequest.Method = System.Net.WebRequestMethods.Ftp.ListDirectoryDetails > > ' If we use FTP/SSL (AUTH SSL) > If nNoFTPProtocol = 2 Then > loFtpWebRequest.EnableSsl = True > End If > > loFtpWebResponse = loFtpWebRequest.GetResponse() > > Using loStreamReader As New StreamReader(loFtpWebResponse.GetResponseStream()) > > ' Load the files into the string builder > loStringBuilder.LoadString(loStreamReader.ReadToEnd()) > > End Using >>
loFtpWebResponse.GetResponseStream() // the stream
loFtpWebResponse
In addition, could you reuse the following (rather than instantiating each time)New Uri(lcURI) New System.Net.NetworkCredential(cUsername, cPassword)