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;