Asp.net|web in asp.net, the pages sent to the client browser are dynamically generated by the base class in the. NET Framework. This base class is the page class in the Web page frame, and an instantiated page class is a Web form, that is, Web forms. And so, a ASP.net page, is a Web form. As a Form object, you have properties, methods, and events that you can use as containers to hold other controls. This design inherits the benefits of Visual Basic: Quickly and efficiently build applications. As a result, this web programmer can write Web applications as quickly and easily as a desktop application, and no change in programming patterns or habits is necessary, whether from a desktop programmer to a Web programmer or a Web programmer to a desktop programmer.
A Web form is a text file that is saved as. aspx with a suffix, which you can open and write with any text editor. We know that ASP.net is the operating mechanism of the compiler, in order to simplify the programmer's work, an. aspx page does not need to be compiled manually, but rather when the page is invoked, the CLR decides whether or not to compile it. In general, in the following two cases, the. aspx page is recompiled:
1. The ASPX page was first requested by the browser;
2. ASPX page is overwritten
Because. aspx pages can be compiled,. aspx pages have the same performance as components. This allows the. aspx page to be at least twice as fast as the same functional. asp page!
Any. htm pages or. html pages can easily be converted to. aspx pages, and. htm pages or. html pages are not compiled by the server. As the following hello.htm page file, its HTML code is as follows:
<HTML>
<HEAD>
<title>hello</title>
</HEAD>
<body>
Hello,i Love china!
</body>
</HTML>
When converting to an. aspx file, you simply change the suffix name. htm to. aspx (that is, hello.aspx) to complete the conversion from. htm to. aspx. The effect of browsing through the browser is the same, but the operating mechanism and efficiency is not the same, hello.aspx is a Web form after the compiled page class dynamically generated, and hello.htm is the direct call file. Two files run as shown in Figure 4.1 and 4.2.
Figure 4.1 hello.htm page Run results
Figure 4.2 hello.aspx page Run results
To really understand Web forms, you need to delve into the code model and the event model for Web Forms. This chapter details the code model for Web Forms and the event model in the following two sections.