开发者

Facebook 'like' button - ASPX Master Pages

How do I add a FaceBook 'like' button t开发者_开发技巧o my master pages, does it need to be different for each page?


Use the Facebook Like Button generator here:

Facebook Like Button Generator

Paste the generated iframe code into your master page. If you leave it as is it will 'like' your site, not specific pages.

To 'like' the individual pages you can take the generated code and look for a section like this:

src="http://www.facebook.com/plugins/like.php?href=mysite.com&

Modify that to read:

src="http://www.facebook.com/plugins/like.php?href=<%=Request.Url.ToString() %>&amp;

And that should work to 'like' each specific page.


You should also add the META property of the generated facebook like button dynamically: use a HtmlGenericControl in the code behind. I wrote a full article how to add an asp.net like button while using master pages : link text

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜