protected override object GetRuntimeObject(object result) { object runtimeObject; ConfigurationSection section = result as ConfigurationSection; if (section == null) { runtimeObject = result; } else { // Call into config section while impersonating process or UNC identity // so that the section could read files from disk if needed try { runtimeObject = section.GetRuntimeObject(); } catch (Exception e) { throw new ConfigurationErrorsException( SR.Format(SR.Config_exception_in_config_section_handler, section.SectionInformation.SectionName), e); } } return(runtimeObject); }
protected internal virtual object GetRuntimeObject() { if (SectionHandler != null) { ConfigurationSection parentSection = sectionInformation != null?sectionInformation.GetParentSection() : null; object parent = parentSection != null?parentSection.GetRuntimeObject() : null; if (RawXml == null) { return(parent); } try { // This code requires some re-thinking... XmlReader reader = new ConfigXmlTextReader( new StringReader(RawXml), Configuration.FilePath); DoDeserializeSection(reader); if (!String.IsNullOrEmpty(SectionInformation.ConfigSource)) { string fileDir = SectionInformation.ConfigFilePath; if (!String.IsNullOrEmpty(fileDir)) { fileDir = Path.GetDirectoryName(fileDir); } else { fileDir = String.Empty; } string path = Path.Combine(fileDir, SectionInformation.ConfigSource); if (File.Exists(path)) { RawXml = File.ReadAllText(path); SectionInformation.SetRawXml(RawXml); } } } catch { // ignore, it can fail - we deserialize only in order to get // the configSource attribute } XmlDocument doc = new ConfigurationXmlDocument(); doc.LoadXml(RawXml); return(SectionHandler.Create(parent, ConfigContext, doc.DocumentElement)); } return(this); }
private object GetRuntimeObjectWithRestrictedPermissions(ConfigurationSection section) { // Run configuration section handlers as if user code was on the stack bool revertPermitOnly = false; try { PermissionSet permissionSet = GetRestrictedPermissions(); if (permissionSet != null) { permissionSet.PermitOnly(); revertPermitOnly = true; } return(section.GetRuntimeObject()); } finally { if (revertPermitOnly) { CodeAccessPermission.RevertPermitOnly(); } } }
private object GetRuntimeObjectWithRestrictedPermissions(ConfigurationSection section) { object runtimeObject; bool flag = false; try { PermissionSet restrictedPermissions = base.GetRestrictedPermissions(); if (restrictedPermissions != null) { restrictedPermissions.PermitOnly(); flag = true; } runtimeObject = section.GetRuntimeObject(); } finally { if (flag) { CodeAccessPermission.RevertPermitOnly(); } } return runtimeObject; }
private object GetRuntimeObjectWithRestrictedPermissions(ConfigurationSection section) { object runtimeObject; bool flag = false; try { PermissionSet restrictedPermissions = base.GetRestrictedPermissions(); if (restrictedPermissions != null) { restrictedPermissions.PermitOnly(); flag = true; } runtimeObject = section.GetRuntimeObject(); } finally { if (flag) { CodeAccessPermission.RevertPermitOnly(); } } return(runtimeObject); }
private object GetRuntimeObjectWithRestrictedPermissions(ConfigurationSection section) { // Run configuration section handlers as if user code was on the stack bool revertPermitOnly = false; try { PermissionSet permissionSet = GetRestrictedPermissions(); if (permissionSet != null) { permissionSet.PermitOnly(); revertPermitOnly = true; } return section.GetRuntimeObject(); } finally { if (revertPermitOnly) { CodeAccessPermission.RevertPermitOnly(); } } }
private object GetRuntimeObjectWithFullTrust(ConfigurationSection section) { return section.GetRuntimeObject(); }
private object GetRuntimeObjectWithFullTrust(ConfigurationSection section) { return(section.GetRuntimeObject()); }
object IInternalConfigSystem.GetSection(string configKey) { ConfigurationSection s = Configuration.GetSection(configKey); return(s != null?s.GetRuntimeObject() : null); }
private object GetRuntimeObjectWithRestrictedPermissions(ConfigurationSection section) { return section.GetRuntimeObject(); }