How to use static values (parameters) from web.config file

If you have static values that you use across your .NET application, one place to store these values is the web.config file.

Let’s say you use your application’s name in several pages in your application. Instead of hard coding this value in each page, it’s easier and more efficient to store it as a parameter in the web.config file.

Example record in web.config:

<add key="APPLICATION_NAME" value="My application"/>

In order to read this value in your code-behind file, use this line:


Leave a Reply