UrlMappingCollection.Remove メソッド

定義

UrlMapping オブジェクトをコレクションから削除します。

オーバーロード

名前 説明
Remove(String)

指定した名前の UrlMapping オブジェクトをコレクションから削除します。

Remove(UrlMapping)

指定した UrlMapping オブジェクトをコレクションから削除します。

Remove(String)

指定した名前の UrlMapping オブジェクトをコレクションから削除します。

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

パラメーター

name
String

コレクションから削除する UrlMapping オブジェクトの名前。

次のコード例では、UrlMappingからUrlMappingCollection オブジェクトを削除します。

コレクションを取得する方法については、 UrlMappingCollection クラスのトピックのコード例を参照してください。


// 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

注釈

Remove メソッドは、現在の階層レベルのadd セクションのurlMappings要素を削除し、remove要素を挿入します。 remove 要素は、階層内の上位レベルの親構成ファイルで定義されている add 要素への参照を実質的に削除しますが、削除しません。

こちらもご覧ください

適用対象

Remove(UrlMapping)

指定した UrlMapping オブジェクトをコレクションから削除します。

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)

パラメーター

urlMapping
UrlMapping

コレクションから削除する UrlMapping オブジェクト。

次のコード例では、UrlMappingからUrlMappingCollection オブジェクトを削除します。

コレクションを取得する方法については、 UrlMappingCollection クラスのトピックのコード例を参照してください。


// 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

注釈

Remove メソッドは、現在の階層レベルのadd セクションのurlMappings要素を削除し、remove要素を挿入します。 remove 要素は、階層内の上位レベルの親構成ファイルで定義されている add 要素への参照を実質的に削除しますが、削除しません。

こちらもご覧ください

適用対象