PageMethod vs WebSerivce/ServiceMethod

Last post 08-21-2006 8:48 AM by Garbin. 6 replies.

Sort Posts:

  • PageMethod vs WebSerivce/ServiceMethod

    08-15-2006, 12:55 PM
    • Contributor
      3,846 point Contributor
    • rchern13
    • Member since 07-14-2005, 12:52 PM
    • Saint Louis
    • Posts 829
    I've seen people say that we shouldn't use PageMethods and should stick with using web services as is currently written, however, I've not seen a reason why.  My situation right now is that I want to combine the HoverMenuExtender and DynamicPopulateExtender to display a preview of an item for my gridview.  However, my site uses forms authentication, and if I try to pull the html (screen grab) from the page, I just get the forms login page.  So I'm curious as to why I shouldn't use a page method which wouldn't have the authentication problem.  We already have a webservice running, and I'd rather use that webservice, but since it seems like I can't - I'd rather use a page method then start another webservice.
    HTH, rchern.

    Churned Ajax Toolkit

    Please choose "Mark as Answer" for the posts that lead you to a solution.
  • Re: PageMethod vs WebSerivce/ServiceMethod

    08-17-2006, 10:23 AM
    • Contributor
      3,846 point Contributor
    • rchern13
    • Member since 07-14-2005, 12:52 PM
    • Saint Louis
    • Posts 829
    Surely someone has an opinion Wink
    HTH, rchern.

    Churned Ajax Toolkit

    Please choose "Mark as Answer" for the posts that lead you to a solution.
  • Re: PageMethod vs WebSerivce/ServiceMethod

    08-17-2006, 10:23 AM
    • Contributor
      3,846 point Contributor
    • rchern13
    • Member since 07-14-2005, 12:52 PM
    • Saint Louis
    • Posts 829
    Surely someone has an opinion Wink
    HTH, rchern.

    Churned Ajax Toolkit

    Please choose "Mark as Answer" for the posts that lead you to a solution.
  • Re: PageMethod vs WebSerivce/ServiceMethod

    08-21-2006, 3:20 AM
    • Member
      95 point Member
    • Michael_R
    • Member since 08-17-2006, 10:41 AM
    • Posts 19
    Performance would come to mind. A page method requires an (almost) complete run through the page life cycle. Only the render phase is scipt.
  • Re: PageMethod vs WebSerivce/ServiceMethod

    08-21-2006, 3:40 AM
    • Contributor
      7,416 point Contributor
    • Garbin
    • Member since 09-17-2004, 8:35 AM
    • Sassari, Italy
    • Posts 1,506
    • ASPInsiders
      TrustedFriends-MVPs
    Hi,

    a page method doesn't require a full run through the page lifecycle. For this reason it is the preferred alternative to a partial postback, where the page goes through all its lifecycle.

    Also, in a partial postback, even if only the html for the controls to update is sent in the response, all the web controls are actually rendering their content (but they do it writing into a NullTextWriter).
    Alessandro Gallo | Blog | My book: ASP.NET AJAX In Action
  • Re: PageMethod vs WebSerivce/ServiceMethod

    08-21-2006, 7:36 AM
    • Member
      95 point Member
    • Michael_R
    • Member since 08-17-2006, 10:41 AM
    • Posts 19
    PageMethod:
    I and the IL code disagree. The ScriptModule Registers the PageServiceHandler which in turn sets a RenderMethodDelegate. Therefor, the page runs up unitl the Render method like it would normally. -> Less performance than a WebService call.

    Thanks for the heads up on the UpdatePanel. Checked out the IL Code and there it is (the RenderMethodDelegate) in hte ScriptManager.
  • Re: PageMethod vs WebSerivce/ServiceMethod

    08-21-2006, 8:48 AM
    • Contributor
      7,416 point Contributor
    • Garbin
    • Member since 09-17-2004, 8:35 AM
    • Sassari, Italy
    • Posts 1,506
    • ASPInsiders
      TrustedFriends-MVPs
    Hi,

    apologies for the confusion I made in my last post, you're perfectly right.

    However, my opinion is that the choice between a page method and a web service should be driven by the particular scenario (the data to expose, the need for the elaboration to access the controls on the page) and not by performance.
    Alessandro Gallo | Blog | My book: ASP.NET AJAX In Action
Page 1 of 1 (7 items)