Tuesday, December 29, 2009

How do I add Head tags in .net using c#

There are of course many tags you can use. Here are a couple to get you started... Also, don't forget to set the Title as well. (this.Header.Title = "this is the title";)

  1. keywords
  2. description
  3. robots
  4. date


HtmlMeta metatag = new HtmlMeta();
metatag.Name = "Description";
metatag.Content = "Here's a great description.";
this.Header.Conrols.Add(metatag);

OR, I like it this way...


HtmlMeta metatag = new HtmlMeta(){

   Name = "Description",
   Content = "Here's a great description.",
};

this.Header.Conrols.Add(metatag);

No comments: