How to get a appSettings value in a web.config file

Lets assume the following line has put between the <appSettings></appSettings> node.

<add key="StartingDate" value="09-05-2008" />

Now say, we want to get the value of the “StartingDate” in our C#.net code. All you want to do is, include the following line where you want to get the value.


From the above line of code, you can get the “09-05-2008” value in your .net code.

Note: First of all you have to import the System.Configuration using the following code.

using System.Configuration;

No comments: