Encrypt only connection string password in web.config

Posted by Rickeybglr under ASP.NET on 5/11/2012 | Points: 10 | Views : 24961 | Status : [Member] | Replies : 4
<connectionStrings>
<add name="dbconnection" connectionString="Data Source=.; UserName=abc; Password="abc"Integrated Security=true;Initial Catalog=MySampleDB"/>
</connectionStrings >

i dnt wanna show my password in simple plain text format, instead of this i would like to show in encrypted form.
i dnt wanna encrypt the whole web.config file




Responses

Posted by: Johnbhatt on: 7/7/2012 [Member] Starter | Points: 25

Up
0
Down
One Simple Trick I would like to suggest is below:

First Hash Your Password. using Following syntax.
Put a Textbox in Web Form and Get hash of that text/password by below code.

Response.Write(FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox2.Text, "sha1"));      

To get this code, you need to include Web.Security namespace in File.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/11/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down

Posted by: Patel28rajendra on: 7/11/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

refer this link

http://stackoverflow.com/questions/10291714/encrypting-only-passwords-in-web-config-asp-net

R D Patel

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 7/11/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

here is the other one

http://forums.asp.net/t/1777592.aspx/1

R D Patel

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response