Archive for May, 2008

Securing passwords in Web.config

May 15th, 2008

Here’s a handle litle tool I was previously unaware of.

aspnet_setreg encrypts user names and passwords and copies them into the registry. You can download the tool from here: http://support.microsoft.com/default.aspx?scid=KB;en-us;329290.

Run it like this:
C:\Documents and Settings\David.Bending\Desktop>aspnet_setreg.exe -k:Software\MyApp\Identity -u:myUser@myDomain -p:myPassword

Put this in you Web.config:
<identity impersonate=”true” username=”registry:HKLM\Software\MyApp\Identity\ASPNET_SETREG,userName” password=”registry:HKLM\Software\MyApp\Identity\ASPNET_SETREG,password” />>

The edit the registry key so your ASP user account (typically ASPNET) can read it, and you’re done.

Share