Get A String Value Of Web.Config File
Posted on 2007-11-16
Experts, I am working on a project where I need to get a string value of my web.config file. Is there a way to do this? I attempted to do:
FileStream fs = File.Open(file, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs, Encoding.ASCII);
But it gives me an empty string.
I also tried copying the file first, web.config.copy, and then reading it. Also , It gave me an empty string.
Any ideas? Do I need to create an XmlDocument?
Thanks for the help.