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!