By looking at this code, does anyone know why the ContentLength returns -1 for the file that I am trying to download from a FTP server? The file exists. But, this code returns -1 for lnContentLength.
Dim lcURI As String = ""
Dim lnContentLength As Integer = 0
Dim loFtpWebRequest As System.Net.FtpWebRequest = Nothing
Dim loFtpWebResponse As System.Net.FtpWebResponse = Nothing
lcURI = "ftp://" + cHost + "/" + cRemoteDirectory + "/" + cRemoteFile
loFtpWebRequest = System.Net.FtpWebRequest.Create(New Uri(lcURI))
loFtpWebRequest.Credentials = New System.Net.NetworkCredential(cUsername, cPassword)
loFtpWebRequest.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
loFtpWebRequest.UseBinary = True
loFtpWebResponse = loFtpWebRequest.GetResponse()
lnContentLength = loFtpWebResponse.ContentLength