Another new SEO feature that ASP.NET 4.0 introduces is support for meta description and keywords. I think these are the most abused SEO features ever and search engines are very careful when considering these meta tags but I am very sure that there are still engines that respect those tags and that’s what makes these new features very useful.
Let’s see now how to set meta keywords and description to page. At first let’s create empty ASP.NET page and let’s see through browser the mark up of this page. Mark up should look something like this.
Now let’s write Load event for page. In this event we set meta description and keywords programmatically. Just take the following code in language you prefer.C#
protected void Page_Load(object sender, EventArgs e)
Page.MetaDescription = "This is my rabbits page";
Page.MetaKeywords = "rabbit, rabbits, bunny, bunnies";
Let’s run web application again and see page source through browser again. You should see something like this.
There is one little thing that is annoying for me: meta tags are not splitted to separate lines. To make mark up easier to read I had to insert line breaks manually. But server-side code, as you can see, is simple and straightforward.