
296
|
Chapter 14: The HttpContext Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Handler
IHttpHandler = Context.Handler
Context.Handler = IHttpHandler
Sets or returns an instance of the IHttpHandler for the current request.
Parameter
IHttpHandler
An Object variable of a type that implements the IHttpHandler interface.
Notes
The Handler property can be used to specify special handling for this request. To
understand this idea, you need to understand how requests are processed in IIS.
When a request comes in, unless the item requested is a simple HTML file, the
request is generally handled by an Internet Server API (ISAPI) extension. For
instance, classic ASP and ASP.NET pages are directed to ISAPI applications that
process the request. ISAPI applications are reasonably easy to write in principal,
but are very difficult to create in practice. The IHttpHandler interface is the .NET
way of allowing the developer to write code for requests to be handled in a way
similar to ISAPI applications in IIS, without all of the problems of ISAPI.
IsCustomErrorEnabled
Boolean = Context.IsCustomErrorEnabled
Returns a Boolean value specifying whether custom errors are enabled for the
current request.
Parameter
Boolean
A Boolean variable to receive the value of this property.
Example
The following example displays True if custom errors are enabled; otherwise, ...