Adding Meta tags programmatically in below versions of asp.net 4.5

Unknown | 10:32 AM |

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;

public partial class AddMetaTageProgrammatically : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Adding Title
        Page.Title = "How to add meta tags programmatically.";

        //Adding Meta Descriptions
        HtmlMeta oHtmlMetaDescription = new HtmlMeta();
        oHtmlMetaDescription.Name = "description";
        oHtmlMetaDescription.Content = "How to add meta tags programmatically in asp.net with c#.";
        Page.Header.Controls.Add(oHtmlMetaDescription);
        oHtmlMetaDescription = null;

        //Adding Meta Keywords
        HtmlMeta oHtmlMetaKeywords = new HtmlMeta();
        oHtmlMetaKeywords.Name = "keywords";
        oHtmlMetaKeywords.Content = "meta tags, adding meta tags programmatically, meta tags in asp.net";
        Page.Header.Controls.Add(oHtmlMetaKeywords);
        oHtmlMetaKeywords = null;
    }
}


Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....