Monday, August 27, 2007

Adding Meta Tags to ASP.Net 2.0 Pages

Recently, I was looking for a way to add meta keywords and description into web pages programmatically. After implementing a method to do that I wanted to add different meta keywords and description to the same page but when loading different data. So I came across with this method which you can change meta keywords and description even with in the same page when loading different data.

HtmlMeta htmlMetaDesc = new HtmlMeta();
htmlMetaDesc.Name = "Description";
htmlMetaDesc.Content = "Nalaka Sanjeewa Aluthwala Hewage";

HtmlMeta htmlMeta = new HtmlMeta();
htmlMeta.Name = "Keywords";
htmlMeta.Content = "Nalaka, Sanjeewa, Aluthwala, Hewage";

No comments:

Post a Comment