Search code examples
asp.netajaxasp.net-ajaxasmxwebmethod

Asp.Net Server-side implementation options for Ajax site


I'm very new to the whole Ajax/Asp.Net stuff so...

I know that there are at least a few different ways of implementing the server-side of an Ajax enabled Asp.Net site.

One way is to add static methods to your aspx page's code-behind and mark them with the WebMethod attribute.

Another way is to use a separate ASMX web service file (which I don't know anything about :) ).

What are the most commonly used options for implementing the server-side? What advantages and drawbacks does each one have? And how does each one fare from a security and session perspective? (Making sure the server knows which session the Ajax request is from and ensuring only logged-in users are responded to?)


Solution

  • Typically I like to use jQuery to make the requests to .ashx page that is responsible for reading the data and passing back the JSON to the page to deal with. It sounds like the other options you suggested are pretty complicated by comparison.