Editar

Compartir a través de


HttpHandlerActionCollection.Add(HttpHandlerAction) Method

Definition

Adds an HttpHandlerAction object to the collection.

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)

Parameters

httpHandlerAction
HttpHandlerAction

The HttpHandlerAction object to add to the collection.

Exceptions

The HttpHandlerAction object to add already exists in the collection or the collection is read-only.

Examples

The following code example shows how to create an HttpHandlerAction object and add it to the collection.

// 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))

Remarks

Before using this method you must create an HttpHandlerAction object and initialize it with the proper name and type. After that, you can add the object just created to the collection.

Note

ASP.NET searches for the handler assembly DLL in the application's private Bin directory first, and then it searches in the system assembly cache.

The collection must not already contain an HttpHandlerAction object with the same Verb and Path properties.

Applies to