Can not get property bag at site collection level

Nov 7, 2012 at 9:25 AM

What is wrong???

 

 

 

string crmDataEndPointUrl = string

.Empty;

 

SPSite siteCollection = SPContext

.Current.Site;

 

SPWeb

site = siteCollection.RootWeb;

 

if (site.Properties.ContainsKey("CRMODataEndpointURL"

))

{

crmDataEndPointUrl = site.Properties[

"CRMODataEndpointURL"

].ToString();

}

 

return

crmDataEndPointUrl;