0

Hi i have got the following app.config. How do i get the values for smtp server mail subject etc.

string filePath = ConfigurationManager.AppSettings["SmtpServer"]; i'm getting nothing

actually added key values also the output returned null.

TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

0

It's Simple

1st You set web.config or app.config file value like this.

<appSettings>
<add key="SmtpServer" value="abc" />
</appSettings>

then get value.

string filePath = Convert.ToString(ConfigurationManager.AppSettings["SmtpServer"]);

Or Same as app.config file

 string filePath = System.Configuration.ConfigurationManager.AppSettings["SmtpServer"];
ravi polara
  • 564
  • 3
  • 14