View Full Version : Webservice or HttpHandler? Which one do you prefer?

Oct 21, 2009, 11:47 AM
What do you prefer to use when retrieving data from a simple Ajax request? Webservice (.asmx) or HttpHandler (.ashx)? What are the practical differences between the two? There are Coolite examples using both so not sure which one is the preferred method...

Oct 21, 2009, 1:11 PM
To answer my own question: ASP.NET WebService sucks when dealing with json data. When doing an Ext.Ajax.request call, you have to use jsonData instead of params to send parameters. You have to unwrap the 'd' namespace from the response. You have to specify the contentType as application/json. With .ashx, you just do a normal request. Sooo much easier.

Oct 23, 2009, 8:27 AM
C. AjaxMethods

Oct 23, 2009, 11:07 AM
AjaxMethods is page specific I believe. When creating a reusable control, I find it more flexible if the control takes in an url that can point to a central ashx handler instead of rewriting it for every page that may use the control. If the AjaxMethod is not static/shared, it's actually slower than hitting a webservice/httphandler.