I have a MVC.Net (classic) app. It has a project which has a Class Library. In this class library I have created a app.config file where I setup the appsettings. But at runtime I am always getting null.
Just to illustrate here is the example Solution
- WebApp . Web.Config . MyClassLibrary . App.Config
So a solution has a project WebApp and this webApp has a class library. Class library has the App.config file and has some AppSettings.
At runtime, I am trying to get the value AppSetting under App.Config file but I am getting the null value. Using the blew code:
public static string _rootfolder= ConfigurationManager.AppSettings["RootUploadDataFolder"].ToString();
If I add the AppSettings in Web.config file then I am able to get the values.
So what should I do to read the values from the App.Config file that is residing in the Class Library. Note that I have already reference the class library in the WebApp.