M
Mythran
[STAThread()]
public static void Main()
{
string sectionName = "system.web";
object settings = ConfigurationSettings.GetConfig(sectionName);
Console.WriteLine(
settings == null ? "(null)"
: settings.GetType().ToString()
);
}
I'm trying to access the system.web section in the machine.config file. I
thought that ConfigurationSettings.GetConfig would get the configuration
section that match the sectionName above, from all loaded configuration
files. When I run this, it always gives me null. So, how can I get the
"system.web" section of the machine.config file using ConfigurationSettings?
If I can't do it this way, and I have to do it by loading the machine.config
as an XmlDocument, then what is the best way to get the path to the
machine.config file? I know there are registry keys and I could use
Path.Combine to combine paths, but is there a property on an object that
gives at least part of the path information to the machine.config file?
Any help is appreciated
Thanks,
Mythran
public static void Main()
{
string sectionName = "system.web";
object settings = ConfigurationSettings.GetConfig(sectionName);
Console.WriteLine(
settings == null ? "(null)"
: settings.GetType().ToString()
);
}
I'm trying to access the system.web section in the machine.config file. I
thought that ConfigurationSettings.GetConfig would get the configuration
section that match the sectionName above, from all loaded configuration
files. When I run this, it always gives me null. So, how can I get the
"system.web" section of the machine.config file using ConfigurationSettings?
If I can't do it this way, and I have to do it by loading the machine.config
as an XmlDocument, then what is the best way to get the path to the
machine.config file? I know there are registry keys and I could use
Path.Combine to combine paths, but is there a property on an object that
gives at least part of the path information to the machine.config file?
Any help is appreciated

Thanks,
Mythran