Saturday 1 September 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...