System.Net.HttpWebRequest.Abort Method

Cancels a request to an Internet resource.

Syntax

public override void Abort ()

Remarks

The HttpWebRequest.Abort method cancels a request to a resource. After a request is canceled, calling the HttpWebRequest.GetResponse, HttpWebRequest.BeginGetResponse(AsyncCallback, object), HttpWebRequest.EndGetResponse(IAsyncResult), HttpWebRequest.GetRequestStream, HttpWebRequest.BeginGetRequestStream(AsyncCallback, object), or HttpWebRequest.EndGetRequestStream(IAsyncResult) method causes a System.Net.WebException with the WebException.Status property set to WebExceptionStatus.RequestCanceled.

The HttpWebRequest.Abort method will synchronously execute the callback specified to the HttpWebRequest.BeginGetRequestStream(AsyncCallback, object) or HttpWebRequest.BeginGetResponse(AsyncCallback, object) methods if the HttpWebRequest.Abort method is called while either of these operations are outstanding. This can lead to potential deadlock issues.

Note:

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing.

Requirements

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