System.Net.HttpWebResponse.ContentLength Property

Gets the length of the content returned by the request.

Syntax

public override long ContentLength { get; }

Value

A long containing the number of bytes returned from the Internet resource. This value does not include header information.

Exceptions

TypeReason
ObjectDisposedExceptionThe current instance has been disposed.

Remarks

The HttpWebResponse.ContentLength property contains the value of the Content-Length header returned with the response. If the Content-Length header is not set in the response, HttpWebResponse.ContentLength is set to the value -1.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0