Saturday, September 1, 2018

C#/ASP.Net: app.settings instead of web.config



I have next scenario:




  • One Class Library (For example called Utilities) using one app.config

  • One General Site Web application using web.config and applications with web.config each one.




I need to insert an appsettings called "XXX". obviouslly should set in the Site web.config.



The Utilities library is called in all application that I have inside the Site, then I should set the appsettings key in each web.config (something confusing).



How can I set the key inside app.config and read it? ConfigurationManager only read from Web.Config and I would like to read app.config keys inside Utilites.



Is it possible?


Answer




Hi I found the solution:



if yu want to get the properties of app.config you can use:



var value = Properties.Settings.Default.keyName

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...