ASP. IsPostBack

  • 2021-01-03 20:52:40
  • OfStack

This paper explains the usage of IsPostBack in ASP.NET in detail, which is helpful for readers to master the usage of IsPostBack in ES4en.NET more accurately.

1. Introduction to IsPostBack

Page.IsPostBack is a flag whether the current request is opened for the first time. The call method is Page.IsPostBack or IsPostBack or this.IsPostBack or this.Page.IsPostBack, both of which are equivalent.

1) When 1 URL is opened through the address bar of IE, etc. the first time is no longer opened when the page is opened through the submit button or the server that can cause the submit button to be submitted in the way of POST. (Every time the button is clicked, it is loaded once)

2)IsPostBack is false only when it is turned on for the first time, and true for all other times

3).Net Method to determine whether an Page is opened for the first time: ES36en.Form.Count > 0

4) Each time on Load, put the code that needs to be loaded each time in IsPostBack as needed, and put the code that needs to be loaded only once in if(! IsPostBack).

5) Every time the user sends back any information about the server, the isPostBack attribute will be raised to determine whether the user has ever made a login or other event.

2. Conclusion on IsPostBack:

Analysis of the related processing in the.Net source code leads to the following conclusions:

1) IsPostBack = false for pages migrated using ES58en.Transfer.

2) Post if there is no request value in Request, that is, ES66en. Form =null, then IsPostBack = false; Get = IsPostBack if there is no requested value in Request, i.e. Request. QueryString =null, then IsPostBack = false.

3) IsPostBack = false if the Key in QueryString or Form has no "succVIEWSTATE" and "succEVENTTARGET" and "VIEWSTATEFIELDCOUNT" with no key "null" and the value begins with "succVIEWSTATE" and there is no key-value pair with a value of "ES90en", although there is a request value.

4) When migrating from the screen in Response. Redirect mode, IsPostBack = false at this time.

5) Cross-page commit (CrossPagePostBack) occurs, when accessing the PreviousPage attribute, for source PageIsPostBack=true.

6) When cross-page commit (CrossPagePostBack) occurs, the target page is IsPostBack = false

7) IsPostBack = false for the page migrated to using ES112en. Execute.

8) During the Page run, the corresponding DLL was updated and the tree structure of Page changed, in which case IsPostBack = false on request.

Conclusion:
IsPostBack = false if there is no requested value in Request. If there is a request value but not a special key or value such as "___ 129en", IsPostBack = false (after each request, the Net framework returns a special hidden domain, such as "___ 133en", to the client). Server.Transfer, ES136en.Redirect, CrossPagePostBack, Server.Execute have changed page elements and have been recompiled.


Related articles: