Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
PageHandlerFactory Class
Collapse the table of content
Expand the table of content

PageHandlerFactory Class

Creates instances of classes that inherit from the Page class and implement the IHttpHandler interface. Instances are created dynamically to handle requests for ASP.NET files. The PageHandlerFactory class is the default handler factory implementation for ASP.NET pages.


Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

[PermissionSetAttribute(SecurityAction::LinkDemand, Unrestricted = true)]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Unrestricted = true)]
public ref class PageHandlerFactory : IHttpHandlerFactory

The PageHandlerFactory type exposes the following members.

Protected methodPageHandlerFactoryInitializes a new instance of the PageHandlerFactory class.

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHandlerReturns an instance of the IHttpHandler interface to process the requested resource.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodReleaseHandlerEnables a factory to reuse an existing instance of a handler.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

The PageHandlerFactory class implements the IHttpHandlerFactory interface to provide the default HTTP handler for ASP.NET files. The PageHandlerFactory calls the ASP.NET compilation system to compile, if necessary, and return the exact type corresponding to the URL, and then creates an instance of that type. The page type inherits from the Page class and implements the IHttpHandler interface.

To build a custom page handler factory, implement the IHttpHandlerFactory and register the custom PageHandlerFactory class in the Web.config file for the application in the httpHandlers Element (ASP.NET Settings Schema) configuration section.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft