Question

Is there any difference in using one over the other?

Should I be retrieving data from a database using web services? Or is it better to call methods from code-behind (or somewhere similar) with ajax to retrieve data?

Was it helpful?

Solution

When you say "calling methods from codebehind", what are you referring to? Do you mean "page methods"? Those are web services, just limited ones.

OTHER TIPS

A lot of times, when someone says "Web services", they mean SOAP compliant web services. If they do, then there are a lot of differences. If they just mean a service with an HTTP interface, then calling code-behind meets that requirement.

The main difference that you might care about is SOAP is a cross-language/cross-platform standard that other kinds of frameworks provide support for. So, if you mean to expose your service to other clients (aside from yourself), it might be easier for them to consume. It isn't the only choice -- you could just define a simple REST-based style service.

Calling Page-methods via some ASP.NET only mechanism would be hard for other clients, if you care.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top