As title states, I need to get whole raw XML data from ConfigurationManager but I am unable to find a way to do it.
I tried SectionInformation.GetRawXml(); but I am getting error "This operation does not apply at runtime."
var section = ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;
var s = section.SectionInformation.GetRawXml();
I have a Gupta TD project that uses C# class library to communicate with a web service, and when I try to debug this project my app.config is not used. It works fine when I am executing the program directly, my guess is Gupta TD uses some kind of default configuration and I am unable to locate it, so reading app.config file is not an option, I need to get it from ConfigurationManager and thanks to Michael Randall hint I found it using AppDomain.CurrentDomain.SetupInformation.ConfigurationFile.
Just used the File.ReadAllText
Method
File.ReadAllText("<MyApplicationName.exe>.config")
However it does beg the question why you want to do this.
you can use this to get the name of the ConfigurationFile
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile