0

I'm doing something stupid, I suppose. I swear I've done this before without issues but right now I can't get it to work. I have an HTTP handler written in ASP.NET that I want to invoke via AJAX (using jQuery). In my web.config, I register the handler like this...

 <httpHandlers>
     <add verb="GET" path="~/getPage.axd" type="Handlers.GetPage"/>
 </httpHandlers>

The handler is just setup to test right now...

Namespace Handlers

Public Class GetPage
    Implements IHttpHandler

    Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
        With context.Response
            .Clear()
            .Write("ID: " & context.Request.QueryString("id"))
            .End()
        End With
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property
End Class
End Namespace

And I have the following jQuery to invoke it...

$.get('http://localhost:81/getPage.axd?id=0', function(data) {
  alert(data);
});

I know the URL used to make the request is correct. IIS is setup to route the axd path to the ASP.NET ISAPI filter. I have verified that my handler is not getting invoked (I changed handler to print log message and nothing was printed. Event viewer shows nothing).

Any ideas?

EDIT: When I try to navigate directly to the handler in the browser, I get a 404 error.

1
  • What do you get when you browse to the handler directly? Commented Mar 12, 2009 at 0:38

1 Answer 1

1

Got it. I had my path wrong in web.config

<httpHandlers>
  <add verb="GET" path="getPage.axd" type="Handlers.GetPage"/>
</httpHandlers>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.