Atlas 1: Try not to use page methods
One of the easiest thing in Atlas is to use the
Page Method feature. If you use Atlas on your web page say
Default.aspx, you can directly call public methods on Default.aspx
from javascript. Just put a [WebMethod] attribute on a public
method in Default.aspx and then you can them from Javascript using
PageMethods.MethodName().
public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e) { }
[WebMethod]
public
string
DoSomething(
string
param) {
return
param; } }
On the client side you can call this method like this:
PageMethods.DoSomething(
'
Hi
'
,
function
(result) { alert(result); }
);
Here's the catch, Page method calls are always HTTP POST calls.
You can never make HTTP GET call to the Page methods but you can
make HTTP GET calls to Web service method. So, on later stage of
your project when you will need Http response caching in order to
save roundtrips, you will have to refactor all page methods to web
service methods and for this you will have to move all public
methods and related code from default.aspx to some web service. So,
try not to use Page methods from Day 1.