HttpListenerPrefixCollection.Remove Method

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

Removes the specified Uniform Resource Identifier (URI) from the list of prefixes handled by the HttpListener object.

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

virtual bool Remove (
	String^ uriPrefix
) sealed
public final boolean Remove (
	String uriPrefix
public final function Remove (
	uriPrefix : String
) : boolean



A String that contains the URI prefix to remove.

Return Value

true if the uriPrefix was found in the HttpListenerPrefixCollection and removed; otherwise false.

Exception typeCondition


uriPrefix is a null reference (Nothing in Visual Basic).


A Windows function call failed. To determine the cause of the exception, check the exception's error code.


The HttpListener associated with this collection is closed.

If uriPrefix is not in the collection, this method does nothing.

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 removes a user-specified prefix from a HttpListenerPrefixCollection.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 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

Community Additions