ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 175
نمايش فراداده

IHttpHandlerFactory

System.Web (system.web.dll)interface

You can implement this interface to create a factory class that can create IHttpHandler instances dynamically. ASP.NET includes standard IHttpHandlerFactory classes like PageHandlerFactory, RestrictedResourceFactory, and WebServiceHandlerFactory (which are not shown in the class library documentation because they are private types).

Using the <httphandlers> section of the web.config file, you can map specific requests to directly to an IHttpHandler class or to an IHttpHandlerFactory class, which will dynamically create an appropriate IHttpHandler class by using the GetHandler( ) method.

Note that the standard factory classes used by ASP.NET do not appear in the MSDN help or this reference. These classes are marked Private and are used exclusively by the ASP.NET framework.

public interface 

IHttpHandlerFactory { // Public Instance Methods public IHttpHandler

GetHandler (HttpContext

context , string

requestType , string

url , string

pathTranslated ); public void

ReleaseHandler (IHttpHandler

handler ); }

Implemented By

System.Web.Services.Protocols.WebServiceHandlerFactory