Page header - Dinammically place meta tags and title in header


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. this.Page.Title = dr1["page_title"].ToString();
  2.  
  3. //keywords
  4. HtmlMeta keywords = new HtmlMeta();
  5. keywords.Name = "keywords";
  6. keywords.Content = dr1["site_keywords"].ToString();
  7. Page.Header.Controls.Add(keywords);
  8.  
  9. //description
  10. HtmlMeta description = new HtmlMeta();
  11. description.Name = "description";
  12. description.Content = dr1["site_description"].ToString();
  13. Page.Header.Controls.Add(description);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.