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.