This project is read-only.

Share on Twitter Button

Topics: ASP.NET 2.0, Themes
Mar 23, 2011 at 11:56 PM

Hi all,

being fairly new to BlogEngine.NET I have been looking for a way to add a share on Twitter button in the bookmark section of the posts. So far, I have managed to get Facebook, Digg and Google Bookmarks to work but Twitter seems to be a bit harder.

Is it possible to integrate Twitter just like Digg, i.e.

<a class="DiggThisButton DiggCompact" href="<%=Server.UrlEncode(Request.Url.ToString())%>">Digg</a>

but in a way that in the Tweet it shows up like: 

"My Blog Title" via @MyBlog 

I could only get the URL to Twitter by using the same method as for the Digg bookmark. When I tried to add the following code, the title still won't show up in the Tweet


I hope you might help me to find out where my mistake lies. Thank you.

Mar 24, 2011 at 1:10 AM

You can use <%=Page.Title %> instead.

Mar 24, 2011 at 10:39 AM
Edited Mar 24, 2011 at 10:39 AM

Thank you, after making extensive use of google I found a solution to my problem which does everything I need it to do.

In case anyone has the same problem, here is how to get My Blog Title "" via @MyBlog transfered to Twitter


<a target="_blank" title="Share on Twitter" href="<%=Server.UrlEncode("" + Convert.ToString(Post.RelativeLink)) %>&amp;count=horizontal&amp;via=MyBlog&amp;text=<% 
string strTitletweet = Post.Title;
string urlStringtweet =
strTitletweet.Replace("'", "");
Response.Write(urlStringtweet); %>"
Mar 28, 2011 at 12:42 AM

Thanks for this.