Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

20.1. Introduction

An HTTP handler is a class that intercepts and handles requests for a resource of a given type on a web server. HTTP handlers are a key feature of ASP.NET. For instance, when you request an .aspx file, a built-in HTTP handler intercepts the request and takes charge of loading and executing the .aspx file. ASP.NET also provides built-in HTTP handlers for .asmx, .ascx, .cs, and .vb files, as well as other file types. The <httpHandlers> element of the machine.config file contains a list of the standard HTTP handlers configured for your web server.

Overriding ASP.NET's Built-in HTTP Handlers

The <httpHandlers> element in machine.config defines how ASP.NET handles requests for all of the standard file extensions found in most ASP.NET applications. These include .aspx, .asmx, .ascx, .cs, .vb, .vbproj, .csproj, .soap, and many others. By placing your own handler settings in web.config, you can override those defined in machine.config. The override maps incoming requests to the appropriate IHttpHandler class you define (see Recipe 20.1's "Discussion" section for more details). The override can be for a single URL or for all requests with a given extension.



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial