Friday, October 26, 2012

How to get absolute URLs in SharePoint

Use the SPSite.MakeFullUrl() function:

public string MakeFullUrl(
string strUrl
)
Simply pass in the string of the relative URL and it returns you the absolute URL.
For example:
string imageUrl = site.MakeFullUrl("/_layouts/images/siteIcon.png"); 

No comments:

Post a Comment