Share via


HTTP Handler

Handles file requests within the ASP.NET 2.0 framework. For example, in ASP.NET 2.0 and SharePoint Products and Technologies, ASPX page and ASMX Web service requests are served by HTTP handlers.

Real World Example

Developers plan to add support for a new file type that will handle AJAX remote calls to the SharePoint environment. They develop a new HTTP handler assembly to service these requests, install it on the server running Microsoft Office SharePoint Server 2007, register it with Internet Information Services (IIS), and then set a reference to the handler for the specified file type in the SharePoint web.config file.

Technical Details

HTTP handlers are modular components used by ASP.NET 2.0, and therefore Office SharePoint Server 2007 and Windows SharePoint Services 3.0, to handle requests for one or more file types. An HTTP handler is composed of an assembly that is registered in the web.config file with a path reference to either a specific file or wildcard file name. When a request is sent to a handler, it includes the HTTP context where the handler can act on the request.

The following is an example of HTTP handlers registered in the web.config file in a SharePoint Web application.

<configuration>
   <system.web>
      …
      <httpHandlers>
         <remove verb="GET,HEAD,POST" path="*" />
         <add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, 
         Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
         <add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,
         DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" 
         type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, 
         Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
         <add verb="*" path="Reserved.ReportViewerWebControl.axd" 
         type="Microsoft.Reporting.WebForms.HttpHandler, 
         Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </httpHandlers>
      …
   </system.web>
</configuration>

More detailed information about HTTP handlers can be found in the Microsoft .NET Framework SDK or in the book Programming Microsoft ASP.NET 2.0 Applications Advanced Topics (Esposito, 2006).

Support Details

An HTTP handler cannot intercept requests for file types if they are not configured first in IIS to be handled by ASP.NET.

HTTP handler assemblies can be installed in the Web application’s bin directory or in the global assembly cache.