Hi!
I want to retrieve the Filesize of a file
on a ftp-server.
I tried this listing :
Dim size As String
Dim reader As StreamReader = Nothing
Try
Dim request As FtpWebRequest = WebRequest.Create("ftp://server.com")
request.Credentials = New NetworkCredential("anonymous", "anonymous")
request.Method = WebRequestMethods.Ftp.GetFileSize
Dim response As FtpWebResponse = request.GetResponse
reader = New StreamReader(response.GetResponseStream)
size = reader.ReadLine()
MsgBox("Size : " + size)
Catch ex As Exception
MsgBox(ex.Message)
Finally
If reader IsNot Nothing Then
reader.Close()
End If
End Try
... You see. It connects to a ftp-server and (I think) retrieves the Filesize.
But the read line, which is put into the Variable "size" is empty.
(I tested the Code with real ftp-usernames and logons on my server.)
You can help me, to retrieve the FileSize of an File on a ftp-Server?
, reg3x
(I'm German

)