SharePointAds TextOnly

Thursday, 6 December 2012

SharePoint Online: Get web full url

Sometimes you need to get full url of current web. following is the short method which will return you full web url.

public string getWebFullUrl( Web web)

string webTitle = web.ServerRelativeUrl.Substring(web.ServerRelativeUrl.LastIndexOf( "/" ) + 1);

return web.Context.Url + webTitle + "/" ;


Remember web.ServerRelativeUrl will return only relative url, as show in following table:

Site Collection URL
Site URL