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
)
void ProcessRequest (
	HttpContext context
)
function ProcessRequest (
	context : HttpContext
)
Not applicable.

Parameters

context

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.

No code example is currently available or this language may not be supported.
package HandlerExample ; 
// Name this J# file HandlerTest.jsl and compile it with the
// command line: vjc /t:Library /r:System.Web.dll HandlerTest.jsl.
// Copy HandlerTest.dll to your \bin directory.
import System.Web.*;

public class MyHttpHandler implements IHttpHandler
{
    // Override the ProcessRequest method.
    public void ProcessRequest(HttpContext context)
    {
        context.get_Response().
            Write("<H1>This is an HttpHandler Test.</H1>");
        context.get_Response().
            Write("<p>Your Browser:</p>");
        context.get_Response().Write(("Type: "
            + context.get_Request().get_Browser().get_Type() + "<br>"));
        context.get_Response().Write(("Version: "
            + context.get_Request().get_Browser().get_Version()));
    } //ProcessRequest

    // Override the IsReusable property.
    /** @property 
     */
    public boolean get_IsReusable()
    {
        return true;
    } //get_IsReusable
} //MyHttpHandler

/*
______________________________________________________________

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

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


// Name this JScript file handlertest.js and compile it with the
// command line: jsc /t:library /r:system.web.dll handlertest.js
// Copy HandlerTest.dll to your bin directory.
import System.Web

package HandlerExample{
    
    class MyHttpHandler implements IHttpHandler{
        
        // Override the ProcessRequest method.
        function IHttpHandler.ProcessRequest(context : HttpContext){
            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.        
        function get IHttpHandler.IsReusable() : Boolean{
            return true
        }
    }
}

//______________________________________________________________
//
// To use the above handler, use the following lines in a
// Web.config file (remove the comment markers)
//
//<configuration>
//   <system.web>
//      <httpHandlers>
//         <add verb="*" path="handler.aspx" type="HandlerExample.MyHttpHandler,HandlerTest"/>
//      </httpHandlers>
//   </system.web>
//</configuration>


Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: