Click here to Skip to main content
13,000,324 members (74,729 online)
Rate this:
Please Sign up or sign in to vote.
In my new project they have used one code like
string A = System.Configuration.ConfigurationManager.AppSettings["CheckPassword"];

What is the use of this code? why the are using this?
What could be the use of this code?
Posted 6-May-13 23:48pm
Updated 6-May-13 23:55pm
Member 9514099 7-May-13 5:51am
From my understanding, it means that the developer has provided with a standard password value in app.config file.
In "string A = System.Configuration.ConfigurationManager.AppSettings["CheckPassword"];" they are trying to assign that value to a variable A.
Check your app.config file for "checkpassword"
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

There will be a web.config/app.config file existing on that application. Check that.

That is xml file usually contains all the configuartion information for the application.

You will find the key CheckPassword inside AppSettings tag under parent tag configuration inside that file something like below.

        <add key="CheckPassword" value="MyValue" />

We store some sensitive information in this manner as to avoid writing it many times whenever needed inside our application.
And if it needs to be changed, then we just need to change at that configuration file and the application will work as intact.

So, according to this hierarchy, you will access that value like below.
string A = System.Configuration.ConfigurationManager.AppSettings["CheckPassword"];
// So, value of A will be "MyValue"

Explore More

1. appSettings Element (General Settings Schema)[^]
Contains custom application settings, such as file paths, XML Web service URLs, or any information that is stored in the.ini file for an application.

2. ASP.NET appSettings[^]
3. ASP.NET Configuration File Hierarchy and Inheritance[^]
4. ASP.NET Configuration Files[^]
Róhän Lêuvà 7-May-13 6:24am
Tadit Dash 7-May-13 6:36am
Thanks Rohan...:)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

My Part of answer
You ll get the value of CheckPassword from web.config or app.config.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

With this code you can read the variables of your program that is saved in the web.config or app.config.
you can access to it from all forms.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100