开发者

How do I inject html into the head section of an aspx page when using master page in VS2005

To be more specific, I'm using a master page and I want to insert rel='canonical' in some pages (for example when I'm using paging in a certain .aspx page).

I need to inject it in the head section of the master page:

This was a step in the right direction: ASP.NET masterpages: how to inse开发者_如何学运维rt markup in the head section inside the aspx? but I need to have more control, to inject only when I have page=2 in the url.

Thanks


The answer is just there in the link. You need to create an content place holder in the master page and then set it in the pages and conditionally set the rel type.


The head section of your masterpage should have it's own contentplaceholder. You can use the contentplaceholder on your subsequent pages in the head section and it will be 'injected' or placed for the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜