Last post Nov 05, 2012 10:03 AM by Vanderbeke
Nov 04, 2012 02:47 PM|Vanderbeke|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 04:17 PM|BrockAllen|LINK
HttpHandlers are a fine way to do this.
Nov 05, 2012 02:37 AM|Vanderbeke|LINK
Does the use of an HttpHandler has any benefits in regard to the other methods ?
Nov 05, 2012 08:45 AM|BrockAllen|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 10:03 AM|Vanderbeke|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.