Rediger

Del via


UrlMappingCollection.Remove Method

Definition

Removes a UrlMapping object from the collection.

Overloads

Remove(String)

Removes the UrlMapping object with the specified name from the collection.

Remove(UrlMapping)

Removes the specified UrlMapping object from the collection.

Remove(String)

Removes the UrlMapping object with the specified name from the collection.

public:
 void Remove(System::String ^ name);
public void Remove (string name);
member this.Remove : string -> unit
Public Sub Remove (name As String)

Parameters

name
String

The name of the UrlMapping object to remove from the collection.

Examples

The following code example removes the UrlMapping object from the UrlMappingCollection.

Refer to the code example in the UrlMappingCollection class topic to learn how to get the collection.


// Remove the URL with the
// specified name from the collection
// (if exists).
urlMappings.Remove("~/default.aspx");

// Update the configuration file.
if (!urlMappingSection.IsReadOnly())
  configuration.Save();
' Remove the URL with the
' specified name from the collection
' (if exists).
urlMappings.Remove("~/home.aspx")

' Update the configuration file.
If Not urlMappingSection.IsReadOnly() Then
    configuration.Save()
End If

Remarks

The Remove method deletes the add element in the urlMappings section at the current hierarchy level and inserts a remove element. The remove element effectively removes the reference to the add element defined in the parent configuration files at higher levels in the hierarchy but does not delete it.

See also

Applies to

Remove(UrlMapping)

Removes the specified UrlMapping object from the collection.

public:
 void Remove(System::Web::Configuration::UrlMapping ^ urlMapping);
public void Remove (System.Web.Configuration.UrlMapping urlMapping);
member this.Remove : System.Web.Configuration.UrlMapping -> unit
Public Sub Remove (urlMapping As UrlMapping)

Parameters

urlMapping
UrlMapping

The UrlMapping object to remove from the collection.

Examples

The following code example removes the UrlMapping object from the UrlMappingCollection.

Refer to the code example in the UrlMappingCollection class topic to learn how to get the collection.


// Create a UrlMapping object.
urlMapping = new UrlMapping(
  "~/home.aspx", "~/default.aspx?parm1=1");

// Remove it from the collection
// (if exists).
urlMappings.Remove(urlMapping);

// Update the configuration file.
if (!urlMappingSection.IsReadOnly())
  configuration.Save();
' Create a UrlMapping object.
urlMapping = New UrlMapping( _
"~/home.aspx", "~/default.aspx?parm1=1")

' Remove it from the collection
' (if exists).
urlMappings.Remove(urlMapping)

' Update the configuration file.
If Not urlMappingSection.IsReadOnly() Then
    configuration.Save()
End If

Remarks

The Remove method deletes the add element in the urlMappings section at the current hierarchy level and inserts a remove element. The remove element effectively removes the reference to the add element defined in the parent configuration files at higher levels in the hierarchy but does not delete it.

See also

Applies to