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.