How get web config location element?
ConfigurationManager.GetSection("appSettings") returns Okay
ConfigurationManager.GetSection("location") return null
I.E. ...
<location path="FOLDER/Page2.aspx">
...
</location>
Does this help?
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationLocationCollection myLocationCollection = config.Locations;
foreach (ConfigurationLocation myLocation in myLocationCollection)
{
Console.WriteLine("Location Path: {0}", myLocation.Path);
Configuration myLocationConfiguration = myLocation.OpenConfiguration();
Console.WriteLine("Location Configuration File Path: {0}", myLocationConfiguration.FilePath);
}
Console.WriteLine("Done...");
Console.ReadLine();
Taken from here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With