HttpWebResponse.ContentLength Property

 

Gets the length of the content returned by the request.

Namespace:   System.Net
Assembly:  System (in System.dll)

override ContentLength : int64 with get

Property Value

Type: System.Int64

The number of bytes returned by the request. Content length does not include header information.

Exception Condition
ObjectDisposedException

The current instance has been disposed.

The 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, ContentLength is set to the value -1.

The following example displays the value of this property.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: