C# Reading Configuration settings

Total Post:128


 1946  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?

  1. Re: C# Reading Configuration settings

    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;

      Modified On Apr-04-2018 03:45:24 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.