Access web.config key from codebehind
I have a key in the web.config file like:
<add key="MailFrom" value="my@email.com"/>
I need to 开发者_StackOverflowaccess it in the code behind.How to do this in c#?
You could use the AppSettings property indexer:
string from = ConfigurationManager.AppSettings["MailFrom"];
精彩评论