Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 5th, 2006, 06:10 PM
Friend of Wrox
 
Join Date: Feb 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default META tags and master pages

Does anyone know how to make dynamic meta tags with master pages?



Neil Timmerman
Programmer
Veris Consulting
 
Old October 9th, 2006, 01:02 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You can add HtmlMeta controls to the header, like this:
Code:
      // Set the keywords tag
      HtmlMeta metaTag = new HtmlMeta();
      metaTag.Name = "keywords";
      metaTag.Content = "My, Keywords";

      Page.Header.Controls.Add(metaTag);

      // Set the description tag
      metaTag = new HtmlMeta();
      metaTag.Name = "description";
      metaTag.Content = "My Description";

      Page.Header.Controls.Add(metaTag);
      In addition to this, your master page can expose string properties for the keywords and description tags that you can set from the content pages.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using meta tags amatytfc ASP.NET 2.0 Basics 1 August 6th, 2007 05:47 PM
meta tags ferlach HTML Code Clinic 5 June 5th, 2007 04:17 PM
Customer Support Site Master Pg. Meta Tags taggiese BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 February 26th, 2007 11:35 PM
MasterPages ContentPages and Meta tags michaelcode ASP.NET 2.0 Basics 5 June 1st, 2006 04:13 PM
Meta tags Adam H-W HTML Code Clinic 2 November 19th, 2003 11:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.