HttpListener.Abort Method

Note: This method is new in the .NET Framework version 2.0.

Shuts down the HttpListener object immediately, discarding all currently queued requests.

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

public void Abort ()
public void Abort ()
public function Abort ()

This method disposes of all resources held by this listener. Any pending requests are unable to complete. To shut down the HttpListener object after processing currently queued requests, use the Close method.

After calling this method, you will receive an ObjectDisposedException if you attempt to use this HttpListener.

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

The following code example demonstrates calling this method.

public static void CheckTestUrl(HttpListener listener, HttpListenerRequest request)
    if (request.RawUrl == "/")
        listener.Abort ();


Windows 98, Windows Server 2003, Windows XP Media Center Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0