HttpRequest.Abort 方法


強制終止造成任何待處理 I/O 失敗的基礎 TCP 連線。Forcibly terminates the underlying TCP connection, causing any outstanding I/O to fail. 您可以使用此方法,以回應惡意 HTTP 用戶端攻擊。You might use this method in response to an attack by a malicious HTTP client.

 void Abort();
public void Abort ();
member this.Abort : unit -> unit
Public Sub Abort ()


這個方法是安全線程。This method is thread-safe. 任何執行緒都可以隨時呼叫它。Any thread may call it at any time.

這個方法只能用在整合模式中。This method can only be used in integrated mode. 如果您在傳統模式中叫用它,就會擲回例外狀況。If you invoke it in classic mode, an exception is thrown. 若要判斷管線模式,請使用 UsingIntegratedPipelineTo determine the pipeline mode, use UsingIntegratedPipeline.