static PingServiceCollection GetPingServiceInfo() { PingServiceCollection pingServiceCollection = new PingServiceCollection(); string fullPath = SiteConfig.GetConfigPathFromCurrentContext() + "PingServices.xml"; if (File.Exists(fullPath)) { FileStream fileStream = FileUtils.OpenForRead(fullPath); if (fileStream != null) { try { XmlSerializer ser = new XmlSerializer(typeof(PingServiceCollection)); StreamReader reader = new StreamReader(fileStream); pingServiceCollection = (PingServiceCollection)ser.Deserialize(reader); // add to cache DataCache cache = CacheFactory.GetCache(); cache.Insert("PingServices", pingServiceCollection, new CacheDependency(fullPath)); } catch (Exception e) { ErrorTrace.Trace(TraceLevel.Error, e); } finally { fileStream.Close(); } } } // add some defaults if (pingServiceCollection.Count == 0) { pingServiceCollection = PingService.GetDefaultPingServices(); } return(pingServiceCollection); }