Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET1.0 .NET2.0 .NET3.0 C#3.0 , +
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 7-May-13 0:48am
Kavitha_b1.4K
Edited 7-May-13 0:55am
vijay__p4.7K
v2
Comments
Member 9514099 at 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
good
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.
 
<configuration>
    <appSettings>
        <add key="CheckPassword" value="MyValue" />
    </appSettings>
</configuration>
 
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)[^]
Quote:
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[^]
  Permalink  
v2
Comments
Róhän Lêuvà at 7-May-13 6:24am
   
↑ed..!
Tadit Dash at 7-May-13 6:36am
   
Thanks Rohan...:)
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 235
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2014
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