a) In Asp.Net we can check whether a request is a postback or not via Page.IsPostBack property.But where does this property get its value from? Thus, where in the incoming request does browser put this value?
b) As far as I can tell, hitting a reload button also causes browser to send form data back to the server. Thus, is under the hood hitting browser’s reload button same as pressing a submit button ( which is nested within a FORM element)?
c) Assuming browser displays A.aspx for the fist time and assuming user clicks browser’s reload button, then I would think this request will be considered as a postback by Asp.Net (especially since browser also sends back any form data), but it’s not. Why?
thanx
The IsPostBack property only looks to see if the request made is a POST request action. If it is a POST, then IsPostBack returns true.
Hitting reload / refresh on a browser does NOT in general send any form data to the server – most of the time this causes a GET request (which is the default request you send any time you first visit a site).
If you click refresh on a page that was received as a result of a POST operation, then the browser will ask the user if they would like to submit the data again before doing the POST request again. A browser will not resubmit any form data unless the user confirms it (at least that is how it works in the IE, Firefox and Chrome).
Fiddler is a great tool to help with this kind of situation. It sits in the middle between the browser and the server and you can watch all of the traffic go back and forth. You can download it here.