Friday, July 9, 2010

Add metatags dynamically in asp.net,c#

Add metatags dynamically in asp.net,c#


Add following name space-
using System.Web.UI.HtmlControls;

And than use the below code .This will automatically adds your chosen meta tag to the page header.

meta = new HtmlMeta();
meta.Name = "your meta name";//What meta tag you want to add i.e. title ,keyword,description etc
meta.Content = "your meta content";//What is the content for the meta tag
base.Page.Header.Controls.Add(meta);

No comments:

Post a Comment

Popular Posts