Library tutorials & articles

Implementing HTTP Handlers in ASP.NET

Introduction

When I first started out, it was hard to find information on how to setup an ASP.NET HTTP handler. Of course, after time, I've found a wealth of articles, posts, and comments from others on these and other related topics. As my second post in the HTTP module/handler saga, I hope to give you an in-depth discussion on the topic of handlers to include pros, cons, and a sample implementation that you can extend.

Introduction

ASP.NET uses HTTP handlers to process all requests. For general information on HTTP handlers (and modules), see my previous article, Introduction to ASP.NET HTTP Modules and Handlers. In the following sections, I will discuss a few pros and cons of HTTP handlers and provide a step-by-step guide to implementing your own handler.

Most notably, HTTP handlers are beneficial because they provide a way to interact with HTTP requests before they get to a web page. This can be very nice, depending on what you need to do with the request. For instance, perhaps there is a need for logging actions taken by users or controlling access to individual files (i.e. images, executables). For the purposes of this article, I will discuss using handlers for URL rewriting.

This is intended to be a work in progress, so let me know if there is something extra that you'd like to see in it, or, if there are any mistakes/inconsistencies. Any other feedback is welcome, as well.

Comments

  1. 21 Nov 2007 at 12:24

    I haven't touched this since .NET 1.1. And, with IIS7, I'd say there's a better approach. I'll probably revisit this when I have some time to play with IIS7.

  2. 20 Nov 2007 at 05:45

    Did you ever find a better solution for the ActionLess form - for Url Rewriting ???

    Your post to experts exchange requires a subscriptin to read the answer...

     

    Cant I just get away with in NET 2.0 putting form id='myForm' Method=""

    I know it is malformed ...

  3. 01 Jun 2006 at 20:40

    You seem to have forgotten an important problem with your actionless form. I have discovered that this custom form will disable the validation controls. Now the onsubmit function for client side validation needs to be added back in. I found this post about the problem (http://www.experts-exchange.com/Web/Q_21842631.html), but am still wondering if there is not an easier way to fix this.

  4. 13 Mar 2005 at 21:15

    thank you very much. I am knew this posting and waiting for nothoing

  5. 01 Jan 1999 at 00:00

    This thread is for discussions of Implementing HTTP Handlers in ASP.NET.

Leave a comment

Sign in or Join us (it's free).

Michael Flanakin Michael Flanakin is a principal .NET software architect for the US Air Force and is the president of the Air Force .NET User Group, which serves .NET developers world-wide. Michael provides guidanc...

Related podcasts

Events coming up

  • Mar 15

    DevWeek 2010

    London, United Kingdom

    DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET 4.0, Silverlight 3, WCF 4, Visual Studio 2010, REST, Windows Workflow 4, Thread Synchronization, ASP.NET 4.0, SQL Server 2008 R2, LINQ, Unit Testing, CLR & C# 4.0, .NET Patterns, WPF 4, F#, Windows Azure, ADO.NET, Entity Framework, Debugging, T-SQL Tips & Tricks, and more.

We'd love to hear what you think! Submit ideas or give us feedback