IHttpHandlerFactory::GetHandler Method
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>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.