我怎样才能在web.config中的不同部分引用appSetting [英] How can I reference an appSetting in a different part of web.config
问题描述
我有我的的appSettings
在 Appsettings.Dev.Config
称为一个独立的配置文件中定义的,我包括我的的web.config文件里面
文件,像这样
I have my appSettings
defined in a separate config file called Appsettings.Dev.Config
, and I include that file inside my web.config
file like so
<appSettings configSource="ConfigFiles\AppSettings.Dev.config"/>
让说的文件中的设置之一是
Lets say one of the settings in the file is
<add key="MailerEmailAccount" value="myemail@myserver.com" />
我可以访问设置的值 MailerEmailAccount
里面的其他地方的web.config?怎么样?
Can I access the value of the setting MailerEmailAccount
elsewhere inside web.config? How?
推荐答案
不,Web配置文件不能从本身拉设置;它不是动态的。的动态功能,唯一的排序是包括其他的.config的能力,但是这只是一种东西的,好像他们是我的一部分吸所有这些设置。
Nope, the web configuration file cannot pull "settings" from itself; it's not dynamic at all. The only sort of dynamic functionality is the ability to include other .config, but that's just a "suck all these settings in as if they were part of me" kind of thing.
这篇关于我怎样才能在web.config中的不同部分引用appSetting的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!