I was creating a web-application for one of my clientele, where I was supposed to add Meta-Tags dynamically to ASP.NET page. This kind of worried me for some time. Then I thought, let me open up the Visual Studio 2005 IDE.

I was playing around in Object Browser with System.Web namespace when I found a new class…

HtmlMeta…! Hurray!

Let me try, was my first thought and the results were beautiful.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
///
Summary description for CommonFunctions
/// </summary>

public static class CommonFunctions
{

public static void SetHeading(Page pg, string sHeading)
{
HtmlMeta meta = new HtmlMeta();
meta.Name =
“keywords”;
meta.Content =
“Company Name, products,” + “,” + sHeading ;
pg.Controls.Add(meta);
}
}

The site is now Search-Engine Optimized. The content can be changed dynamically!