System.Net.FtpWebResponse.ContentLength Property

Gets the length of the data received from the FTP server.

Syntax

public override long ContentLength { get; }

Value

Documentation for this section has not yet been entered.

Remarks

When a response stream is returned by the FTP server, the FtpWebResponse.ContentLength property contains the number of bytes in the stream. FtpWebResponse.ContentLength returns −1 if no data was returned in the response or if the server did not send content length information. The return value is greater than or equal to zero if data was or should have been returned. For example, for requests that use the System.Net.WebRequestMethods.Ftp.ListDirectory field, the FtpWebResponse.ContentLength property always returns −1. For requests that use the System.Net.WebRequestMethods.Ftp.UploadFile method, the FtpWebResponse.ContentLength property is always zero. For requests that use the System.Net.WebRequestMethods.Ftp.DownloadFile method, the property is greater than zero if the downloaded file contained data and is zero if it was empty.

For requests that use the System.Net.WebRequestMethods.Ftp.GetFileSize method, FtpWebResponse.ContentLength returns the size of the specified file on the server.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0