ASP Web Form Quick Start for. NET
Compile the first Web Form page
ASP. NET Web Form pages are plain text files with. aspx as the file extension. When the client browser requests a. aspx file, ASP. NET will parse and compile the target file as a. NET Architecture class, and then this class will dynamically process the incoming requests. Note: The. aspx file is compiled only at the first access, and the class instance will be reused in subsequent requests. This is roughly the same as JSP processing. Haha, what the hero sees is always the same at the end :-)
The simplest way to create an ASP. NET page is to change the suffix of an existing HTML file to. aspx without modifying any code. The following routine collects user names and selects directories:
Intro1.aspx
Click execute to view the source code
In the preceding example, when a user clicks the "Lookup" button, nothing appears. This is because this. aspx file only contains static HTML content.
Use ASP <%> Blocks
ASP. NET provides a syntax structure compatible with ASP. This includes a code block that supports <%> and uses it to write HTML and. aspx code in a mix. These code segments are executed on the page in the order from top to bottom.
See the following example:
Intro2.aspx
Click execute to view the source code
Unlike ASP, codes in the aspx file between <%> are compiled instead of interpreted and executed using the script engine. After such processing, the program running efficiency is greatly improved.
In ASP. NET, you can use the <%> code block to dynamically modify the HTML output content like ASP. For example:
Intro3.aspx
Click execute to view the source code
Although the <%> code block can be used to customize the output content of the ASP. NET page, a clear HTML programming model cannot be well established. This can be seen from the source code of the example.