infolink

Tuesday, March 9, 2010

How to parse Meta Tags

The other day I needed to parse a custom ASP.NET meta tag. Here is what I came up with:

List metas = new List();
foreach (Control c in this.Page.Header.Controls)
if (c.GetType() == typeof(HtmlMeta))
{
HtmlMeta meta = (HtmlMeta)c;
if (meta.Name == "CategoryID")
strMeta = meta.Content;
}

No comments:

Post a Comment

Amazon1