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 物件的名稱。

範例

下列程式碼範例會 UrlMappingUrlMappingCollection 移除 物件。

請參閱類別主題中的 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

備註

方法 Removeadd 刪除目前階層層級區 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 物件。

範例

下列程式碼範例會 UrlMappingUrlMappingCollection 移除 物件。

請參閱類別主題中的 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

備註

方法 Removeadd 刪除目前階層層級區 urlMappings 段中的專案,並插入 remove 專案。 remove 元素實際上會移除階層中較高層級上父組態檔中定義的元素參考 add ,但不會刪除它。

另請參閱

適用於