Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I keep on hearing this words 'callback' and 'postback' tossed around.
What is the difference between two ?

Is postback very specific to the ASP.NET pages ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
513 views
Welcome To Ask or Share your Answers For Others

1 Answer

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 to 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 the Console. 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:

ASP.NET Page Life Cycles
(source: esri.com)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...