Dynamic SEO for c# website,How To Set Html Title, Meta Keywords & Meta Description From Asp.Net(C#.Net)

Task: Put SEO stuff (Title of page, Meta keyword, Meta description) in website using c# code in asp.net website/ web application. Onsite SEO –in Dynamic Website or E-Commerce Website.

Description: Now these day SEO is a very important thing in a Website (Dynamic Website or E-Commerce Website). When we work on SEO for website then we require the setup page title, Meta keyword, Meta description. So we require option for this in admin panel for Content Management System Website.

Here I use a small function for this, you can connect it to database and call on pageload.

C# Code for Dynamic SEO

  public void settitle(string pagetitle, string metakeyword, string metadescription)
        HtmlTitle obj = new HtmlTitle();
        obj.Text = pagetitle;

        //  or title can be set as
        Page.Title = pagetitle;

        HtmlMeta mt = new HtmlMeta();
        mt.Name = "keywords";
        mt.Content = metakeyword;

        //  or can be set as, for position of meta tag

        HtmlMeta mtd = new HtmlMeta();
        mtd.Name = "description";
        mtd.Content = metadescription;

       //  or can be set as, for position of meta tag


  1. Thanks for this code. Helpful code.

  2. Very Thanks for this code its very helpfull