Encrypt and Decrypt Connection String in web.config

by aherrick 23. July 2008 03:55

It can be a good idea to encrypt your connection string before deployment of an web application in ASP.NET.  Plus, it's easy!  Let me show you how.

In command prompt (start -> run -> cmd) navigate to your Asp.Net directory usually found at %WINDOWS%\Microsoft.Net\Framework\version

If you have already setup your application in IIS use the following synatx to encrypt:

aspnet_regiis -pe "connectionStrings" -app "/YourApplicationHere"

Similarly to decrypt:

aspnet_regiis -pd "connectionStrings" -app "/YourApplicationHere"

One thing to note, make sure you are encrypting the connection string on the production box. It will not work to encrypt your connection string on another box and move your web.config into production.

Let me know if this worked for you!

Tags: ,



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen
Tweaked by ajondeck.NET

About the author

Andrew Herrick
I am a full time developer for Blue Horseshoe Solutions based out of Carmel, Indiana. I enjoy learning new technology and hope to give back with some of the cool things I pick up along the way.  Check me out on Stack Overflow!


Categories

None

Recent comments

Comment RSS

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008