HttpResponseMessage.EnsureSuccessStatusCode HttpResponseMessage.EnsureSuccessStatusCode HttpResponseMessage.EnsureSuccessStatusCode HttpResponseMessage.EnsureSuccessStatusCode Method

Definition

Throws an exception if the IsSuccessStatusCode property for the HTTP response is false.

public:
 System::Net::Http::HttpResponseMessage ^ EnsureSuccessStatusCode();
public System.Net.Http.HttpResponseMessage EnsureSuccessStatusCode ();
member this.EnsureSuccessStatusCode : unit -> System.Net.Http.HttpResponseMessage
Public Function EnsureSuccessStatusCode () As HttpResponseMessage
Returns

The HTTP response message if the call is successful.

Exceptions

Remarks

The EnsureSuccessStatusCode method throws an exception if the HTTP response was unsuccessful. If the Content is not null, this method will also call Dispose to free managed and unmanaged resources.

Applies to