How to achieve static ASP. NET Website, asp.net achieve static

Source: Internet
Author: User

How to achieve static ASP. NET Website, asp.net achieve static

The extension of pages implemented by ASP. NET is. aspx, which is a popular dynamic webpage format. Dynamic Web pages are characterized by information interaction and timely updates, with fewer page files and fast development speed. However, a serious problem is that when the traffic volume is large and the server configuration and resources are limited, each access may frequently process program logic, read/write databases, and so on, reduces server performance.
Tools/Raw Materials
Asp.net
Static Method 1:
Rewrite the Render () method of the static dynamic page. cs file for each page, as shown in. Note that the parameter in the red box indicates the name of the static page to be generated. This method is easy to implement, but every time you access the page, the Render () method is re-executed to generate the page, with low performance.

Static Method 2:
1. Recreate An aspx page to generate a static page for each dynamic aspx page. As shown in, only static pages are generated on the Content Page and home page. Of course, this example is a simple example. The actual situation is complex, but the principles are the same.

2. Generate the content page:
In this example, different content pages are differentiated by different IDs. Enter different ID values and click "generate content page" to call and execute background code (for example ), generate an html page.
If the content on the Content Page changes, execute the preceding step again and generate a new one.
The parameters in the Code indicate the dynamic url, static website path, and static file name, which must be modified in a more practical way.

3. Generate the Home Page:

Directly click the "generate Homepage" button on the foreground to execute the background code (as shown in) and generate the homepage html. If the content of the home page changes, generate a new one. The parameters in the Code must be modified according to the actual situation.

This experience provides two ideas and methods for generating static pages using a simple example. The actual situation may be more complex, but the principles are the same.

Related Article

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.