views:

9

answers:

1

I have the need to develop a custom HttpHandler in SharePoint. To start, I just coded up a simple example: http://pastebin.com/HXLjR2xT. 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: http://bobbybeckner.com/index.php/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?

A: 

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!.

TehOne