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

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:


Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

Leave a Comment