private static string GetRequiredSetting(string name) { var setting = ConfigurationManager.AppSettings[name]; if (setting != null) { return setting; } throw new Exception(string.Format("Required setting '{0}' not found.", name)); }