Asp.net dynamically generates HTML pages

Source: Internet
Author: User
This function is applicable to websites with poor background database functions, that is, most of the text is not stored in the database records, but in HTML or XML files, and only the index is placed in the database, such Article Title, category, and query keyword. This method is suitable for websites without database support such as ms SQL Server in the background. Applicable to news publishing systems, such as Sina and 163, which dynamically generate HTML pages. Applicable to pages that require dynamic customization Program . Such as forums and chat rooms. You can load custom HTML pages to enhance the appearance. Idea 1. use tools such as DW-MX to generate HTML-format templates, add special tags (such as $ htmlformat $) where the formats need to be added, and use them to dynamically generate files Code Read the template, obtain the content entered at the front-end, add it to the tag location of the template, generate a new file name, and write it to the disk. Then, write the data to the database. 2. html files are hardcoded Using Background code. You can use the htmltextwriter class to write HTML files. Advantage 1. you can create complex pages and add document to the JS file by using methods that contain JS files. the write () method can be used to add content such as the page header and advertisement to all pages. 2. The Index Server of Ms Windows2000 can be used to create a full-text search engine for static html files, and Asp.net can be used to obtain search results in datatable mode. The Index Service of Win2000 cannot find the content of XML files. If both database search and index search are included, this search function is very powerful. 3. Saving server load and saving a lot of resources by requesting a static html file than An ASPX file server. Disadvantages: Hard coding requires a lot of HTML code. Debugging is difficult. In addition, HTML styles generated by hard encoding cannot be modified. If the style of a website is changed, it must be re-encoded, which brings a huge workload in the future. So here we use the first idea to show the code 1.definition (template.htm) HTML template page <HTML>

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.