It took me a little while to get the WebConfigurtionManager to work for me. I wanted to get the Current sites Web.Config file but kept getting the default sites as I was not using the correct OpenWebConfiguration("SOMETHING") string. This si what you need to use to do it.... [c# example below]
System.Configuration.
Configuration oConfig;
string
path = Request.CurrentExecutionFilePath;
path = path.Substring(0, path.LastIndexOf("/"));
oConfig = System.Web.Configuration.
WebConfigurationManager.OpenWebConfiguration(path);
Lets say that you want to get a connection string (called "Live" in this example) from the web.config file loaded into the oConfig object above then you would do the following:
string
strConnectionString;
strConnectionString = oConfig.ConnectionStrings.ConnectionStrings[
"Live"].ConnectionString;