Getting SharePoint absolute site url

Posted by Francis on Stack Overflow See other posts from Stack Overflow or by Francis
Published on 2010-06-17T08:18:22Z Indexed on 2010/06/17 8:23 UTC
Read the original article Hit count: 155

Filed under:
|
|

I need to get the current absolute url of my site from inside an aspx page (no codebehind). I tried $SPUrl, but it get's converted into a relative url.

<asp:Literal runat="server" text="<% $SPUrl:~Site/mypage.aspx %>" />

results in "/mypage.aspx". It's important that I get the full absolute url starting with "http://".

<asp:Literal runat="server" text="<% $SPUrl:~SiteCollection/mypage.aspx %>" />

does the same. The goal is to get this url: "http://myspweb.com/mypage.aspx" as result.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sharepoint