views:

1348

answers:

2

I've created a sample project to simplify my problem. I have this simple handler:

public class HandleThis : IHttpHandler, IRequiresSessionState
{

    public void ProcessRequest( System.Web.HttpContext context )
    {
        // Score.aspx just says "success"
        context.Response.Redirect( "Score.aspx" );
    }

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

Then, in my config, I have this:

<httpHandlers>
<add verb="*"
path="Survey"
type="HttpHandlerTest.HandleThis, HttpHandlerTest" />

Now when I hit http://server/Survey my handler fires.

If I change my project to run with IIS 6, it won't fire (404). I tried manually adding the handler in IIS via: - Web Site Properties - Home Directory - Configuration - Add (browse to my site's .dll), Extension: Survey, uncheck "Verify that file exists"

I notice that IIS (so helpfully) adds the "." in front of my extension, so I hit the site with "b.Survey"; still 404.

Surely it's possible to add a handler in IIS 6?

+3  A: 

In Cassini everything goes through your dev server, even though the programming in the server will throw an exception if you try to use it in integrated mode.

In IIS7 it would work, if you are running the application in integrated mode.

In IIS6 you either have to assign path="*" to ASPNET_ISAPI.dll and then have the same quoted code as above in your web.config, or you have to assign the extension in the path for your handler.

If you're having trouble adding the aspnet isapi as * in IIS6, google for "extensionless IIS6" or something similar for step-by-step tutorials.

I think I made it seem like I wanted a handler for an extensionless url; I don't. I just want my handler to fire. If I type "wtf" as the extension into the mappings/Application extensions dialog of IIS, and try to hit "a.wtf" it still won't fire.
dudeNumber4
Yes, well, what I was hinting at was that the web.config and asp.net isapi need to match and your current solution didn't do that. Anyway, seems like the other person worded it better for you.
+3  A: 

"I tried manually adding the handler in IIS via: - Web Site Properties - Home Directory - Configuration - Add (browse to my site's .dll), Extension: Survey, uncheck Verify that file exists"

It sounds like you're using the wrong "executable" path. The executable path should point to the aspnet isapi dll, not the dll that contains your HttpHandler implementation.

Try using the same path that the .aspx extension is mapped to (often this is: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll).

When I do that I get a completely empty response.
dudeNumber4
I take it you're not actually being redirected to Score.aspx?Are you navigating to the http://server/survey/ URL with a wildcard (*) mapping in IIS?
I just realized my problem; after I changed the executable path to point to aspnet, I then needed to correct what I had in my config (I had changed the extension to ".wtf" in IIS, so I needed to change the config to path="*.wtf"
dudeNumber4