Home » C#

Dynamically change page title and meta tags in C#

17 January 2009 1,068 views Popularity: 3% Share/Bookmark

email

Change page title and meta tags dynamically/programmatically in C#.net

to change page title

Page.Title = “New Page Title”;

to change meta tags

// Create instances of an HtmlMeta control.
HtmlMeta hm1 = new HtmlMeta();
HtmlMeta hm2 = new HtmlMeta();

// Get a reference to the page header element.
HtmlHead head = (HtmlHead)Page.Header;

// Define HTML elements
hm1.Name = “keywords”;
hm1.Content = “keywords of your web page”;
head.Controls.Add(hm1);

hm2.Name = “description”;
hm2.Content = “description of your web page”;
head.Controls.Add(hm2);

Related posts:

  1. Magento: Set/Change page layout, title tag, meta keywords and description
  2. What are Meta-Tags? Full Description of Meta tags
  3. Magento: Show/Hide website to search engines by adjusting robots meta tag
  4. Magento: How to change default page layout?
  5. Magento: Set title, keywords and description in your module
  6. Page refresh in PHP
  7. jQuery: Grey out background and preview image as popup
  8. Magento: How to change or reorder top links?
  9. How to show child page (sub page) list in parent page in wordpress?
  10. WordPress: Optimizing 404 Page Not Found page