locked
Page method vs web method RRS feed

  • Question

  • User-1305530094 posted

    I want to avoid the page life cycle and post backs , i m rewriting all my codes again and convert them to web method based procedure. I noticed the web method performance is better than page method.<br>
    I m not an expert here and I would really appreciate your input regarding the differences in terms of performance and security
    <br>
    Thanks
    Saturday, April 22, 2017 6:46 AM

Answers

  • User-1509636757 posted

    You would get better explanation here ASP.NET page methods vs web service

    Performance wise:

    You might expect page methods to offer better performance than Web services. After all, to resolve Web service calls, the ASP.NET runtime has to parse SOAP packets. This, however, isn't exactly true. ASP.NET AJAX installs a tailor-made HTTP handler (see Figure 3) that intercepts all ASMX requests. Requests with a /js suffix are processed differently, working directly with the JSON payload and Web service method. As a result, no SOAP is involved whatsoever and the body of the request simply contains the JSON stream of input arguments. For non-AJAX requests, the new HTTP handler just delegates the call back to the original ASP.NET handler that understands SOAP.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 22, 2017 6:21 PM