Encrypting your web.config file with ASP 2.0 (Visual Studio 2005)
- Posted: Nov 07, 2005 at 3:35 PM
- 39,201 Views
- 6 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Federal Developer Evangelist, Robert Shelton, Jr., takes you through a short (8 minute) demonstration of how Encrypt portions of your web.config with ASP 2.0 (Visual Studio 2005). This walkthrough shows you how to encrypt two sections of your web.config (AppSettings and ConnectionStrings) with the DPAPI (DataProtectionConfigurationProvider). In addition to these two sections, you can also encrypt your Identity and SessionState sections.
My blog URL: http://sheltonblog.com
Channel 9 Article: Encrypt Configuration Sections in ASP.NET 2.0 Using RSA
MSDN Article: How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI
Please check out some of my other screencast by clicking this search
link. Including a 3 part series on programming Active Directory with Visual Studio 2005.
~ Robert Shelton, Jr.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
If I encrypt a web.config file using aspnet_regiis.exe with -pe or -pef option, get encrypted web.config file and take it to another machine, run aspnet_regiis.exe with -pd or -pdf option, what do I get? A plain file or an error? Do the encryption algorithm uses the PKI or any salt to encrypt so that if you exchange windows accounts or machine, the user does not get to the plain file?
I hope that this is clearer,
Robert
I'm curous it you have to encrypt the config files for every separate installation of the webapp (like you did in the video). I guess the encryption/decryption depends on some machine specific key.
How about web application farms. Is there a way to encrypt the config file once and deploy the decrypted version to all instances in the farm?
Regards,
Johan Sundström
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "connectionStrings" "C:\MyFolder\EncryptionDemo" –prov "DataProtectionConfigurationProvider"

All I got after attempting to run this command from a windows cmd prompt was the aspnet_regiis help screen. What am I missing? I have even ensured my web.config file is not read only and that the aspnet user has full control on the security permissions. Please help. Thanks you.
Sincerely,
Ron Breeding
For example, Johnny Cracker steals the web.config file from my site some how. Could they run -pd on their home IIS 6 server and decrypt the file exposing the information we are trying to hide?
Another possible scenario is that I have a web farm. If server A which I encrypted the file on dies can I decrypt the file on server B?
Just curious,
Thanks again for posting!
Tim Kulp
Remove this comment
Remove this thread
close