I have the need to develop a custom HttpHandler in SharePoint. To start, I just coded up a simple example from here. On line 35 or 36 of that code I get a NullReferenceException thrown if I call my HttpHander page from jQuery. But if I call the page directly in my browser, I get the results I expect. I have seen some examples online for building an HttpHandler in SharePoint and calling it from jQuery and they don't seem to really do anything differently then I am. Ex: Sharepoint list and linq using jquery and ihttphandler

Any ideas on why I can't seem to get the Current context from SPContext when I am calling from jQuery?

1 Answer 1


Ok, this was a really dumb mistake on my part, it actually turns out that I was requesting the wrong path in my jQuery ajax call. I was requesting url: "_layouts/MyStuff/MyHandler.ashx" which was trying to request "/Pages/_layouts/MyStuff/MyHandler.ashx" instead of "/_layouts/MyStuff/MyHandler.ashx". So, changing to the right path solved my problem. Boy don't I feel dumb now!.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.