Hi varsha,
I hope when u want to save passwords in SQL Server, then no need to encrypt them. Bcoz only admin can handle the database. How ever if u want to save user names & passwords in web.config then it will be necessacary. Now the days there r several algorithms so that u can encrypt ur password like DES or Tripple DES. .NET also gives builtin SHA1 & MD5algo.
First suppose u r saving ur passwords in web.config,
<credentials passwordFormat="SHA1" >
<users name=first password="25FDHS252GF5HGF58RT2H5">
</credentials>
For generating the password u will use a seperate procedure HashPasswordForStoringInConfigFile() of FormsAuthentication Class.
u can use it as;
strhashValue = FormsAuthentication.HashPasswordForStoringInConfig File(txtPassword.Text,"SHA1" or "MD5");
I hope, now u hav a good idea about it.
Regards,
Anuj Rathi
|