Skip to main content
added 37 characters in body
Source Link
Robert Lindgren
  • 24.5k
  • 12
  • 53
  • 79

using (var site = new SPSite("url"))

{ using (SPWeb web = site.RootWeb)

{ string url = web.Site.RootWeb.Url;

} }

using (var site = new SPSite("*url*"))    
{ 
   using (SPWeb web = site.RootWeb)    
   {
     string url = web.Site.RootWeb.Url;    
   }
}

using (var site = new SPSite("url"))

{ using (SPWeb web = site.RootWeb)

{ string url = web.Site.RootWeb.Url;

} }

using (var site = new SPSite("*url*"))    
{ 
   using (SPWeb web = site.RootWeb)    
   {
     string url = web.Site.RootWeb.Url;    
   }
}
Source Link

using (var site = new SPSite("url"))

{ using (SPWeb web = site.RootWeb)

{ string url = web.Site.RootWeb.Url;

} }