FAQ in ASP.NET AJAX Networking and Web Services

Rate It (2)

Last post 12-25-2007 11:23 PM by Raymond Wen - MSFT. 0 replies.

Sort Posts:

  • FAQ in ASP.NET AJAX Networking and Web Services

    12-25-2007, 11:23 PM
    Locked

    1. Why can’t I access page controls in PageMethod?


    1. Why can’t I access page controls in PageMethod?
    PageMethod is invoked via Reflection.
    When the server receives a request for the PageMethod, it uses ProcessRequest(HttpContext context) method in System.Web.Script.Services.RestHandler class to serve it. Reflection is used internally to invoke PageMethod which is public and static.
    It’s not accessed via an instance of the page. Also, this request doesn’t go through the regular lifecycle of a normal request for .aspx page. Therefore, controls on the page can’t be accessed inside the PageMethod.
Page 1 of 1 (1 items)