Q1: How does the foreground class access members of the background class?
A1: <% xxx %>. You can add <% xxx %> to the foreground class. xxx indicates a member of the background class. Of course, the foreground class is not accessible to all background class members, and private class members cannot access it, that is, all non-private class members can access it, such as the protected class and pubic class members. The reason is the answer to Question 3...
Q2: How does the background class call foreground control?
A2: runat = "server" must be added to the front-end class control. It is easy to understand the English literal translation, so that this. xxx can be directly used in the background class.
.
Q3: What is the relationship between the foreground class and the background class?
A3: inheritance relationship. We can guess a rough idea from Q1, whether from decompilation or in the page instance of the foreground class.
Inherit can prove that the foreground class inherits from the background class.
Q4: When a browser requests a page, the server creates a response page object through reflection. What is the class name? What method does this object call to process the request?
A4: this class is the foreground class. Because the foreground class inherits from the background class, the background class will be automatically created when the foreground class is created. In my understanding, in layman's terms, since his son already exists, his father must first exist, right?
------------------------------------------------- Small segmentation problem ------------------------------------------------
Now, the user sends a request to the server through a browser. First, the foreground Class Object (that is, the page Class Object) is created, and then converted to the ihttphandle interface object () method. Why should I convert it to an ihttphandle interface object? The reason is very simple, because the server software does not know the methods in different page class objects, the page class objects must be converted into ihttphandle interface objects to be processed by the processrequest () method in the context object.
Q5: [Key] What does the server call a page object to generate HTML code returned?
A5: Control tree. The page object uses the control tree method to encapsulate the HTML source code and C # code of the entire page. to generate the HTML code, you only need to traverse the entire control tree, call the -- redner method in each control to obtain the HTML code of each control, splice it into a complete page code, and finally return the response to the browser. A browser displays the code.