ProcessRequest Method
Collapse the table of content
Expand the table of content

IHttpHandler.ProcessRequest Method

Enables processing of HTTP Web requests by a custom HttpHandler that implements the IHttpHandler interface.

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

void ProcessRequest(
	HttpContext context


Type: System.Web.HttpContext
An HttpContext object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.

Place your custom HttpHandler code in the ProcessRequest virtual method, as shown in the following example.

The following code example writes four lines of text to the HTTP output stream in response to a client request for a page named handler.aspx. All requests for handler.aspx are serviced by the MyHttpHandler class in the namespace HandlerExample contained in the assembly HandlerTest.dll.

// Name this C# file HandlerTest.cs and compile it with the
// command line: csc /t:library /r:System.Web.dll HandlerTest.cs.
// Copy HandlerTest.dll to your \bin directory.

using System.Web;

namespace HandlerExample
   public class MyHttpHandler : IHttpHandler
      // Override the ProcessRequest method.
      public void ProcessRequest(HttpContext context)
         context.Response.Write("<H1>This is an HttpHandler Test.</H1>");      
         context.Response.Write("<p>Your Browser:</p>");
         context.Response.Write("Type: " + context.Request.Browser.Type + "<br>");
         context.Response.Write("Version: " + context.Request.Browser.Version);

      // Override the IsReusable property.
      public bool IsReusable
         get { return true; }


To use this handler, include the following lines in a Web.config file.

         <add verb="*" path="handler.aspx" type="HandlerExample.MyHttpHandler,HandlerTest"/>

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft