By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,707 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Multiple Settings in AppConfig file .Net 2

P: 2

I need to store info for multiple settings in my config file e.g.
MailServer1, MailServer2, MailServer3,
MailBox1, MailBox2, MailBox3

So what I did I created the following setting in the config file



then in my code I would input the variable Location Id and try to access the information as follows -

strLocationId = Location1

strMailServerName = ConfigurationManager.AppSettings(strLocationId & "MailServer")
strMailBoxName = ConfigurationManager.AppSettings(strLocationId & "MailBoxName")

But the above code doesn't work and I don't get any value from the config file.

I would really appreciate any help on this.

Many thanks in advance.

Polly Anna
Apr 26 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 759
Settings should be like this in AppSettings,
<add key="Log" value="LOGValue"/>

Get Values like this,
string strLog=ConfigurationManager.AppSettings.Get("LOG") ;

Apr 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.