Adding Meta Tags to the Head in ASP.NET 2.0

Wednesday, August 26, 2009

You can easily create a HtmlMeta object and add it to the Controls collection in the HtmlHead class exposed via Page.Header. Here's a few samples:




HtmlMeta metaKeyWords = new HtmlMeta();
metaKeyWords.Name = "keywords";
metaKeyWords.Content = "keywords goes here";
this.Header.Controls.Add(metaKeyWords);




HtmlMeta metaDesription = new HtmlMeta();
metaDesription.Name = "description";
metaDesription.Content = "description goes here";
this.Header.Controls.Add(metaDesription);

0 comments:

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP