HttpHandlerActionCollection.Add(HttpHandlerAction) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將 HttpHandlerAction 物件加入集合。
public:
void Add(System::Web::Configuration::HttpHandlerAction ^ httpHandlerAction);
public void Add (System.Web.Configuration.HttpHandlerAction httpHandlerAction);
member this.Add : System.Web.Configuration.HttpHandlerAction -> unit
Public Sub Add (httpHandlerAction As HttpHandlerAction)
參數
- httpHandlerAction
- HttpHandlerAction
要新增到集合的 HttpHandlerAction 物件。
例外狀況
要加入的 HttpHandlerAction 物件已經存在於集合中,或者集合是唯讀的。
範例
下列程式碼範例示範如何建立 HttpHandlerAction 物件,並將其新增至集合。
// Add a new HttpHandlerAction to the Handlers property HttpHandlerAction collection.
httpHandlersSection.Handlers.Add(new HttpHandlerAction(
"Calculator.custom",
"Samples.Aspnet.SystemWebConfiguration.Calculator, CalculatorHandler",
"GET",
true));
' Add a new HttpHandlerAction to the Handlers property HttpHandlerAction collection.
httpHandlersSection.Handlers.Add(new HttpHandlerAction( _
"Calculator.custom", _
"Samples.Aspnet.SystemWebConfiguration.Calculator, CalculatorHandler", _
"GET", _
true))
備註
使用這個方法之前,您必須先建立 HttpHandlerAction 物件,並使用適當的名稱和型別加以初始化。 之後,您可以將剛建立的物件新增至集合。
注意
ASP.NET 先搜尋應用程式私人 Bin 目錄中的處理常式元件 DLL,然後在系統組件快取中搜尋。
集合不得已經包含 HttpHandlerAction 具有相同 Verb 和 Path 屬性的物件。