How do you debug ASP.net HTTPHandler

Ronnie Overby picture Ronnie Overby · Jul 28, 2009 · Viewed 27.5k times · Source

I have set a breakpoint in an HttpHandler in visual studio. The HttpHandler is an .ashx file I am trying to debug by running my application in the VS development web server. My breakpoint is not getting hit.

How can I step through it?

Edit: My breakpoint is not getting hit

Answer

Giuseppe Romagnuolo picture Giuseppe Romagnuolo · Sep 17, 2012

Late reply, but it may serve if you have not found your answer with earlier ones.

If you have created your Handler by copying an existing ashx handler your problem may well be that the markup file of your handler is still pointing to the original handler.

VS by default opens the .ashx.cs file when double-clicking on the .ashx file as the markup file is almost never needed.

By right-clicking on the ashx VS will show option to View Markup, make sure that the Class property is not referring to the old handler.

<%@ WebHandler Language="C#" CodeBehind="MyNewHandler.ashx.cs"
    Class="mynamespace.MyOldHandler" %>