View Single Post
  #1 (permalink)  
Old May 27th, 2012, 04:18 PM
Pdesignz Pdesignz is offline
Authorized User
Points: 60, Level: 1
Points: 60, Level: 1 Points: 60, Level: 1 Points: 60, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to add Meta Tags to Master Pages/Content Pages

Hello, I am new to asp.net and am going through Beginning ASP.Net 4.0 and I had a question about meta tags for master pages and content pages. In the past my experience with html and asp pages, I would use meta tags in the <head></head> of the html and asp pages. In these new asp.net and master page concepts, I am a little unsure as to how to use or where to place the meta tags I would like to use.

In the Frontend.Master I have this...

<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>

Would I put the meta data, scripts and css files within the asp:ContentPlaceHolder, but in doing this would then the meta tags be the same for every page that uses this master page?

I then created a new content page to see what is created and I found this contained within the page...

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

Since I want the meta tags to be different on a page by page basis, would I put the meta tags and any scripts that are specific to this page within this tag and any css files or scripts that I want on every page based on the master page I would then put it in the place holder of the master page?

Thank You
Reply With Quote