开发者

Determining which config file a setting originated from?

I am trying to find a way to determine the location of the config file that holds a specific appsetting or connection string value. i.e. I have multiple web sites/apps on an IIS server and I would like to determine if a setting is coming from the app's config, the parent开发者_开发百科 app's config or the machine.config.

Any idea? TIA J


There is no way to do that using System.Configuration because it was designed to be indiscriminate. If you must do what you are trying to do, you will want to manually parse the potential files, those being the app.config/web.config, application.exe.config, and machine.config.

Note: I see you are using .NET 4.0. Note that 4.0 uses application.exe.config instead of the older app.config or web.config, where application is your actual EXE file's name, to read its settings after the product has been installed through a setup.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜