Loading

Difference between a Postback and a Callback

A Postback occurs when the data (the whole page) on the page is posted from the client to the server..ie the data is posted-back to the server, and thus the page is refreshed (redrawn)...think of it as 'sending the server the whole page (asp.net) full of data'.

On the other hand, a callback is also a special kind of postback, but it is just a quick round-trip to the server to get a small set of data (normally), and thus the page is not refreshed, unlike with the postback...think of it as 'calling the server, and receiving some data back'

With Asp.Net, the ViewState is not refreshed when a callback is invoked, unlike with a postback.

The reason that the whole page is posted with ASP.Net is because ASP.Net encloses the whole page in a <form> with a post method, and so when a submit button is clicked in the page, the form is sent ot the server with all of the fields that are in the form...basically the whole page itself

If you are using FireBug (for Firefox), you can actually see callbacks being invoked to the server in theConsole. That way, you will see what specific data is being sent to the server (Request) and also the data the server sent you back (Response)


The below image illustrates the Page Life Cycles of both a postback and a callback in a ASP.NET based Website:

graphics_page_lifecycle

From:http://stackoverflow.com/questions/365100/difference-between-a-postback-and-a-callback

posted @ 2012-03-16 13:36  Dhoopu  阅读(285)  评论(0编辑  收藏  举报