Add META keywords and Description in ASP.NET (DigitalColony.com)

Add META keywords and Description in ASP.NET

Here is the syntax for programmatically adding META tags to an ASP.NET 2.0 page.

HtmlMeta metaDesc = new HtmlMeta();

metaDesc.Name = “description”;

metaDesc.Content = “Tips on roasting coffee at home”;

Page.Header.Controls.Add(metaDesc);

HtmlMeta metaKey = new HtmlMeta();

metaKey.Name = “keywords”;

metaKey.Content = “roast, coffee, home, tips”;

Page.Header.Controls.Add(metaKey);

ASP.NET will render the above code to valid XHTML META tags.

via Add META keywords and Description in ASP.NET (DigitalColony.com).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.