I. server script Basics
First, let's review the basic execution method of the Web Server Page:
1. The client sends a request to the server by entering the address in the address bar of the browser.
2. After the server receives the request, it sends it to the corresponding Server Page (that is, the script) for execution. The script generates the client response and sends it back to the client.
3. The client browser receives a response from the server, parses the Html, and displays the graphical web page in front of the user.
For the interaction between the server and the client, the following methods are usually used:
1. Form: This is the most important method. Standard controls are used to obtain user input. Form submission sends data to the server for processing.
2. QueryString: Pass the parameter to the server by adding a parameter after the Url. This method is the same as Form in Get mode.
3. Cookies: this is a special method, which is usually used for user identity confirmation.
II. Introduction to ASP. Net
Traditional server scripting languages, such as ASP and JSP, are similar in writing server scripts. They are embedded in Html to explain or compile and execute code, the server platform executes the code to generate Html. For such scripts, the page life cycle is actually very simple, that is, from the beginning to the end, all the code is executed, of course, Servlet compiled in Java can write more complex code, but in terms of structure, it is no different from JSP.
ASP. the emergence of Net breaks this tradition; ASP. net adopts CodeBehind technology and server-side controls, adds the concept of server-side events, changes the script language writing mode, and is closer to Window Programming, making Web programming simpler and more intuitive; but we can see that ASP. net does not change the basic Web programming mode, but encapsulates some details and provides some easy-to-use functions to make the code easier to write and maintain. To some extent, the method of server execution is complicated. This is the subject that we will discuss today: ASP. net Web Page lifecycle.
Iii. ASP. Net Request processing mode
Let's say, ASP. net Web Page is not in the Web programming mode, so it is still working in the request-> receive request-> process request-> send response mode, every interaction with the client triggers a new request. Therefore, the lifecycle of a Web Page is based on a single request.