UrlMappingCollection.Add(UrlMapping) 方法

定义

将指定的 UrlMapping 添加到集合。

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

参数

urlMapping
UrlMapping

要添加到集合的 UrlMapping 对象。

示例

The following code example adds a UrlMapping object to the UrlMappingCollection.

请参阅类主题中的 UrlMappingCollection 代码示例,了解如何获取集合。


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

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

' Add the urlMapping to 
' the collection.
urlMappings.Add(urlMapping)

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

适用于

另请参阅