• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

Adding metadata to MasterPage contentPlaceholder page.

I tried the following based on "Pro ASP.Net 2.0 in C#" recommendation.

in the content page code behind

Page masterPage = base.Master.Page

masterPage.Header.Metadata.Add("Keywords", "great,cool, etc");

The problem is that once I access header, .Metadata is not available.  Was this removed from the release of the 2.0 framework( oh yeah Im using the 2.0 framework)?  If so how do I do add metadata to a MastePage, Content Place Holder page?

Thanks in advance.
0
bisysweb
Asked:
bisysweb
1 Solution
 
trainsdseCommented:
They removed this from 2.0.  The only way I can get around it is to use:

        Page masterPage = this.Master.Page;
        HtmlMeta _met = new HtmlMeta();
        _met.Name = "keywords";
        _met.Content = "great, cool, etc...";        
        masterPage.Header.Controls.Add(_met);

Which works for me.

Thomas
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now