Getting the blog post URL in Community Server 2008

I wanted to get the blog URL of each posting, so that I can implement social media sharing buttons on each and every post.

After some research, here's the solution.

<%# HttpContext.Current.Request.Url.Scheme%>://<%# HttpContext.Current.Request.Url.Host%>
<CSBlog:WeblogPostData runat='server' Property='ViewPostURL' />

As Community Server does not provide the full absolute URL of each blog post, the answer is to retrieve the solution in 3 parts.

  • First, to retrieve the scheme, ie, http, https, hence HttpContext.Current.Request.Url.Scheme.
  • Next, to retrieve the host, HttpContext.Current.Request.Url.Host and
  • finally, <CSBlog:WeblogPostData runat='server' Property='ViewPostURL' /> retrieves the relative URL for the current blog posting.
Published Fri, 20 Dec 2013 @ 2:31 PM by chuacw
Related articles:

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Enter the following code to ensure that your comment reaches the intended party:
Enter the numbers you see in the image: