Monday, May 11, 2009

how to add mata keyword & meta description in ASP.NET?

There is no easy way to add but I have a simple method to introduce


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

public class PageEx : System.Web.UI.Page

private HtmlMeta
metaDescription = new HtmlMeta();
private HtmlMeta metaKeywords = new

public string Description
get { return
metaDescription.Content; }
set { metaDescription.Content = value; }

public string[] Keywords
(metaKeywords.Content == null)
return new string[] { "" };
return metaKeywords.Content.Split(new char[] { ',' });

if (value != null)
metaKeywords.Content =
string.Join(",", value);

public PageEx()
Init += new EventHandler(PageEx_Init);

void PageEx_Init(object
sender, EventArgs e)
//Add the description Meta control
metaDescription.Name = "description";
//Add the keywords Meta
metaKeywords.Name = "keywords";



protected void Page_Load(object sender, EventArgs e)

this.Description = "the power 123";
this.Keywords = new string[] {
"Enquiries", "enquiry", "contact", "contacts", "email", "tel" };


Hope this helps :)


Bak said...

thanks for your sharing! great helpful!!!Louboutin Shoes Christian Louboutin ShoesChristian Louboutin Pumps Wedding Dress ShopsWedding Dress ShopsChristian Louboutin Boots Christian Louboutin PumpsChristian Louboutin Heels Christian Louboutin SandalPigalle Christian Louboutin fur bootschristian louboutin fur bootslouboutin pumpslouboutin fur bootscoyote fur bootschristian louboutin heelssilver strappy sandalschristian louboutin toundraloubitan studded bow peepvintage wedding dresses wedding dressescheap mobile phoneWedding Dresses 2011Wedding Dress ShopsOff the Shoulder Wedding Dressesbridal jacketswedding jacketsbridal jacketshalter neck wedding dressesoff the shoulder wedding dressesvintage wedding dresseswedding dresses with sleeveswedding jackets for the brideSorry for the bother, God bless you.

Sunmaster2020 said...

so good? how u get all those things?

u no be property agent? y be programmer?

Anonymous said...

Way cool! Some extremely valid points! I appreciate you writing this post and also the rest
of the website is really good.
Review my web page cheap nfl jerseys

Anonymous said...

My partner and I stumbled over here from a different website and thought I should check things out.
I like what I see so now i'm following you. Look forward to finding out about your web page for a second time.
Also visit my web blog

Anonymous said...

Hey! This is my first visit to your blog! We are a collection
of volunteers and starting a new initiative in a
community in the same niche. Your blog provided us beneficial information to work on.

You have done a outstanding job!
Also visit my web site -

Anonymous said...

Yes! Finally something about 2009 nfl jerseys best looking
nfl jerseys.
Feel free to surf my blog post ; Cheap nfl jerseys

Anonymous said...

Hello! Would you mind if I share your blog with my twitter group?

There's a lot of people that I think would really enjoy your content. Please let me know. Thank you
My web-site -