Wednesday, October 12, 2011

Using facebook 'like' button on asp.net master page

Hi Everyone,

First of all use Facebook like button generator from following link:


Copy and paste the generated iframe code into your master page. If you leave it as is it will 'like' your website 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&

now change above to :

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

Hurray!! your like button should be working for each page of your website.

Happy Programming!!!

No comments: