Web Technologies

BLOG for Web Technologies

Freewares, Free E-Books Download, SEO, Tips, Tricks, Tweaks, Latest News, .Net, PHP, ASP, ASP.Net, CSP, MS SQL Server, MySQL, Database
earnptr.com
Tuesday, September 8, 2009
Adding Meta Tags to the Head in ASP.NET 2.0
How to dynamically add meta tags in ASP.NET 2.0

The HtmlMeta class is provided for just that. You can easily create a HtmlMeta object and add it to the Controls collection in the HtmlHead class exposed via Page.Header. Here's a few samples:


// Render: <meta name="keywords" content="Some words listed here" />

HtmlMeta meta = new HtmlMeta();

meta.Name = "keywords";

meta.Content = "Some words listed here";

this.Header.Controls.Add(meta);


// Render: <meta name="robots" content="noindex" />

meta = new HtmlMeta();

meta.Name = "robots";

meta.Content = "noindex";

this.Header.Controls.Add(meta);


// Render: <meta name="date" content="2006-03-25" scheme="YYYY-MM-DD" />

meta = new HtmlMeta();

meta.Name = "date";

meta.Content = DateTime.Now.ToString("yyyy-MM-dd");

meta.Scheme = "YYYY-MM-DD";

this.Header.Controls.Add(meta);





Labels: , ,

posted by WebTeks @ 9:56 PM  
0 Comments:
Post a Comment
<< Home
 
Previous Post
Archives
Links
Template by

Free Blogger Templates

BLOGGER

Subscribe in NewsGator Online Subscribe in Rojo Add to Google Add to netvibes Subscribe in Bloglines Web Developement Blogs - BlogCatalog Blog Directory Blogarama - The Blog Directory Blog Directory & Search engine Computers Blogs - Blog Top Sites Top Computers blogs