5 February 2014

Dynamically Add Meta tags to Aspx Page in Asp.net using C#.net

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // set page title
        Page.Title = "Add meta tags dynamically to aspx page in asp.net";
        //Page description
        HtmlMeta pagedesc = new HtmlMeta();
        pagedesc.Name = "page Description";
        pagedesc.Content =
        "adi dotnet total offers Asp.net,C#.net,SQL Server,Web Services,Ajax,JavaScript,JQuery,Gridview articles, examples and interview questions";
        Header.Controls.Add(pagedesc);
        //page keywords
        HtmlMeta pagekeywords = new HtmlMeta();
        pagekeywords.Name = "keywords";
        pagekeywords.Content = "asp.net,C#.NET,adidotnet,adidotnettotal,dotnettotl,GridView,JavaScript,JQuery";
        Header.Controls.Add(pagekeywords);
    }
}



No comments:

Post a Comment