In The Olden Days
In a web.config file, settings could be placed in an appSettings section like so:
In 8-2017 Microsoft came out with System.Configuration.Manager
for .NET CORE v4.4. Currently v4.5 and v4.6 preview.
Install this nuget package. Add directive to a code file
using System.Configuration;
Now, you can do your
var val = ConfigurationManager.AppSettings["mysetting"];
There is one trick for web sites though - you no longer use web.config
for application settings and configuration sections. You use app.config
as well as other types of projects. But if you deploy in ISS, you might need to use both. In web.config
you supply strictly ISS-related entries. Your app-specific entries go to app.config