How To: Construct absolute url for any item using the SPSite object

In the case when we need to get the absolute url for any item, we can make use of the instance method SPSite.MakeFullUrl.

Example use,-

using(SPSite site = new SPSite(mysiteurl))
{     using(SPWeb web = site.OpenWeb())
    {
      //.. Other lines of code
      string absoluteURL = site.MakeFullUrl(serverRelativeURL);
    }
}