views:

508

answers:

1

Simple task like make AJAX request , pass one parameter and return result, can be done with Web Service and IHttpHandler, so where is the difference ?

+2  A: 

ASP.NET web services are in fact a type of HttpHandler that provide an XML based communication infrastructure based on W3C standards (SOAP/WSDL). This means that non .NET clients can interoperate with ASP.NET web services. In your case where you're making a very simple single ajax request to return a simple result, ASP.NET/XML web services may be overkill.

It may be more beneficial/efficient to implement a simple custom HttpHandler rather than invoking all of the plumbing and overhead associated with ASP.NET web services. With a custom HttpHandler you can just send the parameter you need and return exactly the result you want to see without any of the supporting SOAP xml that would be created when using XML web services.

HTH
Kev

Kev
thanks Kev, now is more clear, with web services I can jump over a lot of work that has to be done if I use IHttpHandler
leshnik
Also, if this is an AJAX service, you should look at using JSON instead of XML if possible, as it's much lighter weight than XML.
David Lively