Http://dflying.dflying.net/1/archive/107_prefer_web_services_to_page_methods_in_atlas_server_side_implementation.html
We can expose a server segment to the client in two ways.AtlasCall:Web ServiceAndPage Method. I recommend that you useWeb Service.
One point that everyone should pay great attention to isWeb ServiceAndPage MethodThe working principle and process are quite different. ForAtlasCallWeb ServiceFor example, when a request is sent, it simply transmits the parameter data to the server method. ForAtlasCallPage MethodFor example, there will be a lot of data transmitted, and all fields in the form, includingViewstateTo the server. On the server side, it also works in the same way as normalPostBackVery similar: In thisPage MethodBefore being called, all the server controls will get their own status. That's whyPage MethodTo access the control status on the page.
Therefore, it is recommended that you usePage Method(For examplePage MethodTo access the control status on the page.Page MethodOtherwise, use as many as possibleWeb service.ProgramPerformance Improvement. UseWeb ServiceAnother benefit is to clarify the program hierarchy.
You canHttp://www.fiddlertool.com/fiddler/DownloadFiddler, A goodHTTP watcherAndDebuggerUsed to monitor the reality of the client and serverHTTPCommunication content.
Here is a sectionWeb Method, But simply returns the current time of the server.
[Webmethod]
Public Datetime getcurrentdatetime ()
{
ReturnDatetime. now;
}
Let's startWeb ServiceAndPage MethodRun this sectionWeb Method, And useFiddlerObserveHTTPCommunication content:
Web Service
Page Method
You can see thatWeb ServiceMode RuntimePostBack to the serverContent-LengthIs0AndPage MethodThe runtime is1718.