ASP.NET

ASP.NET : Custom Handlers

This tutorial covers writing custom HTTP handlers. In Tutorial 2 we saw the ASP.NET pipeline. Remember that the endpoint of all requests handled by ASP.NET is always an implementation of IHttpHandler.

After completing this tutorial, you will be able to

  • Recognize the role of custom handlers in ASP.NET
  • Write custom binary handlers
  • Write just-in-time compiled custom handlers
  • Let IIS and ASP.NET know about your custom handler

ASP.NET includes several classes capable of handling requests in the most common ways. For example, the Page class handles requests by interpreting the query strings and returning meaningful UI-oriented HTML. The Service class interprets incoming query strings as method calls and processes them accordingly. So far, we've been focusing on a single handler-[[<img src="images/shy.gif"/>]]System.Web.UI.Page. However, there are other times when it's appropriate to tweak the processing or even handle it in a completely different way. You may find yourself needing to handle a request in a way not already provided through the System.Web.UI.Page or the System.Web.Services.Service classes. What do you do then? ASP.NET supports custom HTTP handlers for just such occasions.