ASP. NET: Modify the meta attribute in Master Page

Source: Internet
Author: User
We know that meta tags serve as response header packets used to simulate the HTTP protocol. there are many places to use, and there are already many online summaries. Here we will not list them one by one, for example, description (the description of the site on the search engine), keywords (classification keyword ), and http-equiv are added to the Master page to perform Code operations:
1. Generally, you can use the Page. Header attribute to obtain or set the value of the server-side Master 2. Declare the HtmlMeta type and set the corresponding attribute value.
3. register the meta to the Master using the Controls. Add method of Page. Header.
For example:
HtmlMeta metadeworkflow = new HtmlMeta ();
Metadeworkflow. Name = "DESCRIPTION ";
Metadeworkflow. Content = "my description ";
Page. Header. Controls. Add (metadeworkflow );
The HTML code is:
<Meta name = "DESCRIPTION" content = "my DESCRIPTION"/>

Another important attribute is http-equiv. For example, you can refresh a webpage every 2 seconds:
HtmlMeta metadeworkflow = new HtmlMeta ();
Metadegion. HttpEquiv = "Refresh ";
Metadeworkflow. Content = "2 ";
Page. Header. Controls. Add (metadeworkflow );

HTML code:
<Meta http-equiv = "Refresh" content = "2"/>
Of course, we can also specify the character set and GMT time format.

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.