Q:

How to save the Password in C# .NET?

I am making a C#.NET application wherein I have designed an Administrator account. Now to Login in that account the Administrator has to enter the password. 
My Question is  : How do I save that password?
Possible options : 

Global variable (Obviously incorrect because it will be reset to its default value everytime I run the application)
Database Relation (Feasible but it serves to be a scalar relation only....)

I don't want to store it in a scalar relation because I think it is stupid to use a relation for only one entry and one column!
Is there any other optimum way to store the password? 

A:

You can store it salted and hashed in a user settings file.
You can access the default settings file using something like:
private bool CheckPassword(string salt, string password) 
{
   var hash = Encoding.ASCII.GetBytes(salt + password);
   var sha1 = new SHA1CryptoServiceProvider();
   var sha1hash = sha1.ComputeHash(hash);
   var hashedPassword = ASCIIEncoding.GetString(sha1hash);

   return (Properties.Settings.Default.adminPass == hashedPassword);
}

A:

For security reasons I would recommend you to store only the hash of the password and never the clear text password. You could store it in any persistent media you find it convenient: file registry, database, ...

A:

Do you have a database in your system already ? Then just put it there. You will probably have a users table, that can be extended to accomodate the password (?) If not, you could store it in a file.
What really matters, is that you should not store the password in plain text. It is bad security practice. You should one-way hash it using a good hashing algorithm (such as SHA512), preferably using a salt.

