views:

87

answers:

3

When you open a page in the browser, an instance of the page is created on the server. But, when you use AJAX, does anyone know if the entire page object is created at the server on postbacks?

+1  A: 

When you are using ASP.NET Ajax, a AJAX request will still process all code-behind code, however, the only rendering updates will be those to items inside your update panel.

Mitchel Sellers
+2  A: 

Depends. Using an UpdatePanel, the page is instantiated and goes through the normal lifecycle but only your wrapped controls are updated. If you are using PageMethods, they are static and don't require object instantiation.

Assuming ASP.NET AJAX, if you're using another framework the answer will undoubtedly be different.

tvanfosson
+1  A: 

It also depends on whether by using the term AJAX, you are referring to real AJAX or the AJAX .NET toolkit, which mostly is a set of javascript functions, in which 90% or so of them aren't really ajax. In most of those later controls, the entire page is called, and the output is only parsed for the particular information or sections needed. In the case that there is a asynchronous javascript calling the page and parsing it, the asp.net page won't be able to tell the difference between this call and a regular browser view (unless you program it to know the difference), so in this case, the Page Object will be created as well. The only time it will not process the entire page, is when a web method or script method is called.

stephenbayer