RSS
 

Custom Meta Tags

23 Mar
Many search engines uses Mata tags for searching websites contents. In ASP.NET we can make separate meta tags for all pages from database or any other techniques instead of using one masterpage meta tags.

Call following function in page load of every page or in master page.

public void BindPageMetasandTitle()
{
HtmlMeta MetaDescription = new HtmlMeta();
        HtmlMeta MetaKeywords = new HtmlMeta();

        MetaDescription.Name = "Description";
        MetaKeywords.Name = "Keywords";

        this.Page.Title = "Title of your page";
        MetaDescription.Content = @"Description of your page";
        MetaKeywords.Content = @"Keywords of your page";

        Header.Controls.Add(MetaDescription);
        Header.Controls.Add(MetaKeywords);
}

 

Tags: ,

Leave a Reply

 

 
 
 
Improve Your Life, Go The myEASY Way™