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 一個物件並以正確的名稱和類型初始化。 之後,你就可以把剛建立的物件加入集合。
Note
ASP.NET 先在應用程式的私有 Bin 目錄中搜尋處理程序組語言 DLL,然後在系統組裝快取中搜尋。
該集合不得已包含 HttpHandlerAction 具有相同 Verb 和 Path 屬性的物件。