How can i make my http handler

  • Thread starter Thread starter Chintan
  • Start date Start date
C

Chintan

Hi
i want to make my own http handler
can ne one help me or Guide how to do??
 
It's pretty simple.

You create a class that implements the IHttpHandler interface.

You then implement the 2 methods of the interface:

public void ProcessRequest(HttpContext context);
public bool IsReusable{get;}

Here's a simple example:

namespace Test
{
public class SampleHandler : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.Buffer = true;
context.Response.ContentType = "text/xml";
context.Response.Write("<root><node>Hello</node></root>");
context.Response.Flush();
context.Response.End();
}

public bool IsReusable
{
get { return true; }
}
}
}

compile the class, drop it in your bin and add the handler to your
web.config.

If you want, you can download my AMF.NET handler - it let's flash movies
call .NET code. The amf implementation won't be of any interest to you, but
the web documentation explains the web.config in more detail and you can
look at the GatewayHandler.cs class:
http://amfnet.openmymind.net/

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top