[Original] Further understanding of static and dynamic webpages

Source: Internet
Author: User

Today, ASP. NET programming course teacher asked me a question: ASP. NET web pages are displayed from the server to the client browser. Is the page displayed on the browser static or dynamic? At the moment, I did not want to make a dynamic response, because the previous static page ended with a. HTML or. HTM extension is a static page, and such a page has no data exchange with the database and does not need to submit a form. dynamic pages are mostly used. php ,. jsp ,. asp ,. pages ending with extensions such as aspx, which exchange data with servers or databases and need to submit user input data. However, if the instructor says no, the page displayed on the browser is static. Now I am a little confused. It is obviously a page with the. aspx extension. Why is it static? Okay, I need to google it later.

(Alas! I think the teacher praised me in front of the class just now... Shame !!!)


Finally, I found the answer in Tianya Q &:

ASPDynamic Web pages are very different from normal static Web pages in display. The entire running process of dynamic web pages can be divided into the following steps:


1stStep: Enter. asp in the URL bar of the browser.File name, and press enter to trigger this ASP.

2ndStep: the browser changes the Active Server PagesRequest sent to IIS.

3rdStep: IISThis request is received and according to its. aspAnd realize that this is an ASPRequest.

4thStep: IISReceive correct ASP from hard disk or memoryFile.

5thStep: IISSend this file to an ASP. dll file..

6thStep: ASPThe file will be executed from the beginning to the end, and the corresponding static page will be generated according to the command requirements, generate HTMLHome Page.

7thStep: HTMLThe home page will be sent back to the browser.

8thStep: HTMLThe home page will be interpreted and displayed on the user's browser.


The above steps have been greatly simplified to clearly describe the problem. In fact, an ASPIt is not always necessary to re-compile the explanation every time,If the previous request is accepted for the second time and the request does not change, ASPThe previous results are extracted from the data cache, instead of being retrieved again.Run ASPProgram, which can greatly improve the computing speed.

For servers, ASPAnd HTMLThere are essential differences: HTMLIs sent back to the browser without any processing, and ASPEvery commandAre used to generate HTMLFile, which is exactly ASPOne of the reasons why dynamic content can be generated is the complexity of dynamic web pages.

On the other hand, for browsers, ASPAnd HTMLThere is almost no difference, just suffix *. aspAnd *. htm(Or *. html,When the client proposes ASPAfter the request, the browser actually accepts HTMLFormat File. Through the above simple ASPFor example, there are two points that must be remembered:Some code is executed on the server side, some are executed on the client browser side, and what is seen on the browser side is the code output after the server interpretation.

(I personally think the compilation principles of asp and aspx should be the same. I don't know if this is the case. I will check it later)


Oh, it turned out to be like this. Now I understand that (in particular, steps 5, 6, and 7) the original dynamic pages are compiled and sent to the browser in the form of static pages, in this way, the browser displays a static page, even if it is. end of the aspx extension.


Then I did another experiment to verify whether the idea was correct.

In the course of "Network Database" yesterday, the teacher used ASP Web pages to demonstrate to us, so I just deployed it on the browser. open the asp page, right-click to view the source file, and then click. the source web page file of asp is opened in Notepad. Such a comparison shows some differences. (For better identification. an asp page is called an asp Server Page. You can right-click a browser to view the page opened by the source file, vbscript code functions and other codes are not displayed in the client files, but the corresponding functions are implemented. Then I made another one. the aspx page is compared using the same method and found in. server code written on the aspx page is converted using html tags on the client to achieve the desired effect.

In this case, static pages and dynamic pages are not just different extensions, but there are more things in them!


This is even a small achievement today!

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.