Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

asp.net - How can I reference an appSetting in a different part of 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="ConfigFilesAppSettings.Dev.config"/>

Lets say one of the settings in the file is

<add key="MailerEmailAccount" value="[email protected]" />

Can I access the value of the setting MailerEmailAccount elsewhere inside web.config? How?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...