The information about the page are generally store using HTML <META>tags in the <HEAD> section of the page. These tags are also useful for providing information about the page. Thay also help the page to be more search engine friendly.
During the designing phase we can add these tags to the page. But they are static ones. To make them dynamic we have to make them as server control by adding the runat=”server” attribute and access them from our code or we have to create them dynamically during our page load. In this tip I will discuss about a way to create them dynamically:
|
Step 1: Create a object of the HtmlMeta class
HtmlMeta metaObject = new HtmlMeta();
Step 2: Add the attributes to the meta object
metaObject .Attributes.Add("name", "keywords");
metaObject .Attributes.Add("content", "keyword text here");
Step 3: Add the meta control to the header part of the page
Header.Controls.Add(metaObject);
|