Share via


HttpModuleActionCollection.Add(HttpModuleAction) 方法

定義

HttpModuleAction 物件加入集合。

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

參數

httpModule
HttpModuleAction

要加入至集合的 HttpModuleAction 模組。

例外狀況

已嘗試加入存在於集合內的 HttpModuleAction 物件。

範例

下列範例示範如何建立 HttpModuleAction 物件,並將其新增至集合。

// Create a new module object.

HttpModuleAction ModuleAction = 
    new HttpModuleAction("MyModuleName", 
    "MyModuleType");
// Add the module to the collection.
if (!httpModulesSection.SectionInformation.IsLocked)
{
    modulesCollection.Add(ModuleAction);
    configuration.Save();
}
' Create a new module object.
  Dim ModuleAction As New HttpModuleAction( _
  "MyModuleName", "MyModuleType")
  ' Add the module to the collection.
  If Not httpModulesSection.SectionInformation.IsLocked Then
      modulesCollection.Add(ModuleAction)
      configuration.Save()
  End If

備註

HttpModuleAction 物件加入集合。

適用於