Hi,
I have a problem with reading web.config. I can't seem to figure out what's wrong with it.
Below is a snippet of my codes
Instead of getting the string value in c, I got null. I wonder whether this is because I cannot use AppSettings in a web service project. Any help is appreciated. Thanks.
Henry
I have a problem with reading web.config. I can't seem to figure out what's wrong with it.
Below is a snippet of my codes
Code:
[green]//web.config[/green]
<configuration>
<appSettings>
<add key="connectionString" value="server=(local);user=username;password=blabla;database=mydb;Trusted_Connection=yes" />
</appSettings>
</configuration>
[green]//in the source file[/green]
string c = ConfigurationSettings.AppSettings["connectionString"];
Instead of getting the string value in c, I got null. I wonder whether this is because I cannot use AppSettings in a web service project. Any help is appreciated. Thanks.
Henry