One, IsPostBack introduction
Page.IsPostBack is a flag: whether the current request is opened for the first time. The call methods are: Page.IsPostBack or IsPostBack or This.ispostback or This.Page.IsPostBack, both of which are equivalent.
1) when opening a URL via IE's address bar, the first time it is opened, the page will no longer be opened for the first time when it is submitted via the page's submit button or the server that can cause the submitted button to post. (Each time the button is clicked, it is loaded once)
2) IsPostBack is true only if the first time it is opened is false.
3). NET determines whether a page is opened for the first time: request.form.count>0
4) Each time the page load, according to the need to load each time the code is placed in the IsPostBack, only need to load the code once placed in the IF (! IsPostBack).
5) Each time the user callbacks any information on the server, the IsPostBack attribute is raised to determine if the user has ever done a login or other event.
Two, IsPostBack conclusion
The analysis of the related processing in the source code of. NET results in the following conclusions:
1) The Ispostback=false of the page migrated to when Server.Transfer is used for migration.
2) Post method if the request does not have the requested value, that is, Request.Form =null Ispostback=false;get method if the request does not have the requested value, that is, request.querystring = Null is Ispostback=false.
3) If the QueryString or form has a request value, but the key in QueryString or form does not have "__viewstate" and "__eventtarget" and "__viewstatefieldcount", And there is no key of "null", the value begins with "__viewstate" and there is no key value pair that has a value of "__eventtarget", then Ispostback=false.
4) When migrating from the screen using Response.Redirect mode, this is Ispostback=false.
5) A cross-page commit (Crosspagepostback) occurs when the PreviousPage attribute is accessed for the source pageispostback=true.
6) When a cross-page commit (Crosspagepostback) occurs, the target page is Ispostback=false
7) Use Server.Execute to migrate the page to its ispostback=false.
8) The corresponding DLL has been updated during page run and the tree structure of the page has changed, in which case the request is ispostback=false.
In conclusion, it is possible to understand these conclusions: the general case is that if no request value is ispostback=false. If you have a request value but do not include some special keys or values such as "__viewstate", then Ispostback=false (the. NET Framework will return some special hidden domain "__viewstate" to the client after each request). There are special cases where the above rules are not correctly judged and need special treatment, These scenarios include Server.transfer,response.redirect,crosspagepostback,server.execute, where page element changes and recompilation occur.
Asp. NET in IsPostBack detailed