Search code examples
asmxpagemethods

When to use a page method versus creating a web service?


Our team is trying to figure out some guidelines for using pagemethods vs. creating an actual asmx web service. Seems to me that pagemethods are primarily for one off type calls that are specific to the page, where as asmx are intended are intended represents more of a reusable set of operations and services. Does this sound correct?


Solution

  • Yes. If yo intend to have something thats going to be used by multiple application it is wise to create it as a separate service, so you are not repeating code between applications and also if have to change you change in a single place.

    Simple example, If you have lets say a authentication need, and you have 2 app, one web and one windows. If the user base is going to be the same, it does not make sense to go in the Web App create an authentication code/page, the go to you windows app, and do the same all over again. The reason is, what if have to change the hash code for exemple, you would have to go to the web change it, then go to windows change it, and also redeploy window, now if you have a service, you go to the service change it, and everything now works with the new model, and a big plus, you don't have to redeploy the windows app.

    Thats all folks...