1. Use tools such as DW-MX to generate HTML-formatted templates, add special tags (such as $htmlformat$) where needed, and dynamically generate files using code to read the template, then get the foreground input, add to the tag location of the template, and write the new file name to disk , writes the relevant data to the database after writing.
2. Using background code to hard-code HTML files, you can use the HtmlTextWriter class to write HTML files.
Advantages
1. Can be a very complex page, using the method containing JS files, in the JS file to add document.write () method can be added to all pages such as page header, advertising and other content.
2. Static HTML files Use MS Windows2000 's Index server to build Full-text search engines, using asp.net to get search results in a DataTable. The Win2000 Index Service was unable to find the contents of the XML file. If you include a database search and index index double lookup, then this search function will be very powerful.
3. Saving server load, requesting a static HTML file saves a lot more than an ASPX file server resource.
Disadvantage
idea two: If the hard code, the workload is very large, need a lot of HTML code. Debugging difficult. And the HTML style generated with hard coding cannot be modified, and if the site is replaced, it must be coded to bring a huge workload to the later stage.
using (StreamWriter sw=new StreamWriter ("Store path and page name", False,system.text.encoding.getencoding ("GB2312"))
{
SW. WriteLine (HTMLText);
SW. Flush ();
SW. Close ();
}
}
Catch
{
Response.Write ("The file could not to be wirte:");
}
Summary
This method makes it easy to generate HTML files. The program uses a circular replacement, so the template that needs to replace a large number of elements is fast.
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