Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 05, 2012 02:03 PM by Vanderbeke
Nov 04, 2012 06:47 PM|LINK
I've just read a chapter about HttpHandlers and because they don't follow the normal life cycle of a page I was wondering if this would be a good candidate to process AJAX calls in combination with jQuery, for example just like the old ASP. I know there
are other ways to do this, like callbacks and webservices, but I'm curious about his.
Nov 04, 2012 08:17 PM|LINK
HttpHandlers are a fine way to do this.
Nov 05, 2012 06:37 AM|LINK
Does the use of an HttpHandler has any benefits in regard to the other methods ?
Nov 05, 2012 12:45 PM|LINK
If you're using MVC then I'd just implement my Ajax callbacks in MVC action methods as it's easier to manage the request there. If yu're building this API for other applications to consume then I'd suggest looking into WebAPI instead.
Your question seemed to be coming from a web forms perspective, so I didn't mention MVC or WebAPI. Also from WebForms you can build .aspx services or WCF services to handle Ajax calls. The http hanlder gives you more control but is more work. If you want
the runtime to do all the serialization for you, then an asmx service is easy enough to implement.
Nov 05, 2012 02:03 PM|LINK
BrockAllen, thanks for the reply.
I'm aware that I could use WebServices but in my mind I linked WebServices to provide access to some functions of our site via an external source. For that reason I thought a WebService wouldn't be the most optimal choice for an AJAX call.