tags:

views:

297

answers:

5

Now my team working in a project using windows application(c#).

The application have a option for saving the username & password in the client machine for the current login user.so the user can start the application without entering username & password.I didn't have any knowledge in the windows application.Please check the snapshot of my requirement.

Please suggest good example/reference.

alt text

+1  A: 

This article might be a good starting place:
Credential Management with the .NET Framework 2.0
http://msdn.microsoft.com/en-us/library/aa480470.aspx

ho1
A: 

If you're looking for a simple solution, saving the user name and password in user settings would work. However, this approach is not very secure at all because any other user with sufficient privileges on this machine could simply read the saved settings and steal your login details.

Bus
A: 

The simple solution suggested by Bus above with encryption on the password may have some value.

sanbornc
+2  A: 

To persist user credentials easily and in a secure way you can write them to the application configuration file using the ConfigurationManager class, secure the password using the SecureString class and then encrypt it using tools in the Cryptography namespace.

Edit: This might help: Encrypting Passwords in a .NET app.config File

Ucodia
+1 for securing and encrypting itNever store the password as a clear string.
Sagar
A: 

Here's a class you can download and possibly use. It uses the windows Credential API and provides a dialog, much like the credential dialog in windows, that allows you to save credentials.

It was a proof of concept I did, but it was never need in a production application. So use at your own risk :)

whatknott
I think this class will be *very* similar to the code you'll find in the link @ho posted.
whatknott