ASP.NET 学习一 基础 内容摘自msdn

ASP.NET Web pages allow you to create dynamic content for your Web site. With a static HTML page (.htm or .html file), the server fulfills a Web request by reading the file and sending it as-is to the browser. In contrast, when someone requests an ASP.NET Web page (.aspx file), the page runs as a program on the Web server. While the page is running, it can perform any task that your Web site requires, including calculating values, reading or writing database information, or calling other programs. As its output, the page dynamically produces markup (elements in HTML or another markup language) and sends this dynamic output to the browser.

Postbacks and Round Trips

ASP.NET pages run as code on the server. Therefore, for the page to be processed, the page is configured to submit to the server when users click buttons (or optionally, when users select check boxes or interact with other controls in the page). Each time, the page is submitted back to itself so it can run its server code again and then render a new version of itself back to the user.

The processing cycle for an ASP.NET Web page is this:

1.        The user requests the page. (The page is requested using an HTTP GET method.) The page runs for the first time, performing preliminary processing if you have programmed it to do so.

2.        The page dynamically renders markup to the browser, which the user sees as a Web page similar to any other page.

3.        The user types information or selects from available choices and then clicks a button. (If users click a link instead of a button, the page might simply navigate to another page, and no further processing takes place on the first page.)

4.        The page is posted to the Web server. (The browser performs an HTTP POST method, which in ASP.NET is referred to as a postback.) Specifically, the page is posted back to itself. For example, if the user is working with the page Default.aspx, clicking a button on the page posts the page back to the server with a target of Default.aspx.

5.        On the Web server, the page runs again. The information that the user typed or selected is available to the page.

6.        The page performs the processing that you have programmed it to do.

7.        The page renders itself back to the browser.

This cycle continues as long as the user is working in the page. Each time the user clicks a button, the information in the page is posted to the Web server and the page runs again. Each cycle is referred to as a round trip. Because page processing occurs on the Web server, each action that the page can do requires a round trip to the server.

Note An ASP.NET Web page can run client script, which does not require a round trip to the server, and which is useful for user input validation and for some types of UI programming.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值