c# - How do you pull values from a linked App.config in Web application when Web.config exists? -
i have mvc .net web application written in c# , have web.config file associated web specific configuration values. have windows service application running on server in background has app.config associated it. have linked file within web application , can see file updated values. unable use values in controller display them ui. there way make call app.config values use in controller , views of web application? right seems coming in null due them not being in web.config.
any apprecaited.
as long permissions worked out, should able open shared config file thusly:
var map = new execonfigurationfilemap(); //todo: resolve path in whatever way makes sense situation. map.execonfigfilename = @"c:\myconfig.config"; var config = configurationmanager.openmappedexeconfiguration(map, configurationuserlevel.none); //do config, e.g. config.appsettings.settings["blah"]; otherwise, can put shared settings machine.config, it's typically wise not mess file.
Comments
Post a Comment