Home > DeveloperSection > Forums > C# Reading Configuration settings
Ashish Pandey

Total Post:128

Posted on    January-31-2014 11:23 PM

 C# C# 

 1 Reply(s)
 1335  View(s)
Rate this:

I have a C# class library A which has some configuration settings in its App.config I access them with



string connectionString = ConfigurationManager.AppSettings["ConnectionString"];


But when I call Method 1() from my ASP Web project B, it cannot find the configurations settings in the Class library A

Any idea what is happening here?

Pravesh Singh

Total Post:412

Posted on    January-31-2014 11:40 PM

Hi Ashish,

I believe you can use OpenExeConfiguration to do this:

string exePath = "<full path and name of the app .exe file>";

System.Configuration.Configuration otherConfig =


You could put the path of the other .exe in the web app's web.config (for instance, in the appSettings section), and read it from there, which would be better than hard-coding it here.

to view the appSettings in that config file:

AppSettingsSection otherAppSettings = otherConfig.AppSettings;

Don't want to miss updates? Please click the below button!

Follow MindStick