System.Net.WebResponse.ContentLength Property

When overridden in a descendant class, gets or sets the content length of data being received.

Syntax

public virtual long ContentLength { get; set; }

Value

A long containing the number of bytes returned from the resource.

Exceptions

TypeReason
NotSupportedExceptionThis property is not implemented in the derived class.

Remarks

The WebResponse.ContentLength property contains the length, in bytes, of the response from the Internet resource. For request methods that contain header information, the WebResponse.ContentLength does not include the length of the header information.

Note:

The System.Net.WebResponse class is an abstract class. The actual behavior of System.Net.WebResponse instances at run time is determined by the descendant class returned by WebRequest.GetResponse. For more information about default values and exceptions, please see the documentation for the descendant classes, such as System.Net.HttpWebResponse and System.Net.FileWebResponse.

Requirements

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