IHttpHandlerFactory::GetHandler Method (HttpContext^, String^, String^, String^)
Returns an instance of a class that implements the IHttpHandler interface.
Assembly: System.Web (in System.Web.dll)
IHttpHandler^ GetHandler( HttpContext^ context, String^ requestType, String^ url, String^ pathTranslated )
Parameters
- context
-
Type:
System.Web::HttpContext^
An instance of the HttpContext class that provides references to intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
- requestType
-
Type:
System::String^
The HTTP data transfer method (GET or POST) that the client uses.
- url
-
Type:
System::String^
The RawUrl of the requested resource.
- pathTranslated
-
Type:
System::String^
The PhysicalApplicationPath to the requested resource.
The following code example demonstrates how to create custom handler objects in response to a client request. The example has two parts:
A handler factory class.
A Web.config file excerpt.
The first part of the example shows how to create custom handler objects in response to a client request for a page named either abc.aspx or xyz.aspx. The handler factory class named hwf creates the appropriate handler object depending on the page requested.
The second part of the example shows a Web.config file excerpt. To use the above handler factory, add the following lines to the Web.config file.
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="abc.aspx" type="test.MyFactory,HandlerFactoryTest" />
<add verb="*" path="xyz.aspx" type="test.MyFactory,HandlerFactoryTest" />
</httpHandlers>
</system.web>
</configuration>
Available since 1.1