Creating and Consuming ASP.NET AJAX Page Methods
Web services provide a great way to exchange data between ASP.NET AJAX pages and a server using lightweight JSON messages (see my previous articles for examples of integrating Web services into ASP.NET AJAX applications). However, creating a separate .ASMX Web service file and adding the ScriptService attribute to the service class may feel like overkill in situations where a single page consumes the service's methods. In some cases, it's more convenient to simply add the functionality provided by the Web service directly into an ASP.NET code-beside page. In these cases, ASP.NET AJAX page methods can be used instead of Web Services.