Skip to main content
2 of 4
No advertising please
Robert Lindgren
  • 24.5k
  • 12
  • 55
  • 79

Simple way to get the root site collection from SPContext.Current:

// root site – eg. Web App url string rootSiteCollectionURL = SPContext.Current.Web.Site.WebApplication.Sites[0].Url; // site collection url string SiteCollectionURL = SPContext.Current.Web.Site.Url;