How can I put meta tag to work only for one page. If I want to put it .aspx file, where is right place.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since you haven’t said yet, I’m assuming you’re using the Razor engine (the “default” for new MVC3 projects). In that case, you just need to insert a new section into your layout view, and only render that section if you need to insert a meta tag.
For example, working from the stock New ASP.NET MVC 3 Project template, you would edit your
Views\Shared\_Layout.cshtmlfile, and before the closing</head>tag, do something like this:Then, in any of your views that you needed to, add this:
If you’re still using the ASPX layout engine for some reason, you can accomplish the same thing using the
<asp:ContentPlaceHolder>tags in your master page and<asp:Content>tags in your views.EDIT:
Since you’re using the ASP.NET Forms layout engine still, here’s the same basic idea as above in aspx syntax:
In your master page, you add the tag:
And in your .aspx views, you add a new content section (you should already have at least two — a title and a body):