ASP Web Form Quick Start for. NET (2)

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.