Saturday, February 26, 2011

ASP.NET Interview question :- How do we write a HttpHandler ?

ASP.NET Interview question :- How do we write a HttpHandler ?


Answer:
This is a simple a .NET Interview question .Its a two step process.

First create a class which implements Ihttphandler
public class clsHttpHandler : IHttpHandler
{
   public bool IsReusable
   {
       get { return true; }
   }
   public void ProcessRequest(HttpContext context)
   {
      // Put implementation here.
   }
}

Step 2 make a entry in the web.config file.

<httpHandlers>
<add verb="*" path="*.gif" type="clsHttpHandler"/>
</httpHandlers>

You can view my top ASP.NET Interview questions and answers

No comments: