HttpResponseMessage.IsSuccessStatusCode Property

Definition

Gets a value that indicates whether the HTTP response was successful.

public:
 property bool IsSuccessStatusCode { bool get(); };
bool IsSuccessStatusCode();
public bool IsSuccessStatusCode { get; }
var boolean = httpResponseMessage.isSuccessStatusCode;
Public ReadOnly Property IsSuccessStatusCode As Boolean

Property Value

Boolean

bool

A value that indicates whether the HTTP response was successful. true if HttpStatusCode is in the Successful range (200-299); otherwise, false.

Remarks

If the server doesn't return a successful HttpStatusCode in the Successful range (200-299) for the request, then the HttpResponseMessage.IsSuccessStatusCode property is set to false.

Calling HttpResponseMessage.EnsureSuccessStatusCode causes the value of IsSuccessStatusCode to be checked, and an exception thrown if that value is false.

Applies to

See also