How to encrypt Connection string in Web.Config file using Asp.Net
While developing web projects we generally keep our Connection String under the Web.config, which get stored in plain text format which anybody can read. Connection String contains database connections, username, password etc. which is threat to your secured data.
The best idea is to keep our connection string in encrypted format which is not easily readable and which makes your connection string safe.
HOW TO ENCRYPT CONNECTION STRING
1. First Create web project in asp.net, then add connection details to web.config file.
2. Go to Start > All Programs >> Microsoft visual studio 2008 >> Visual Studio Tools >> Visual Studio 2012 Command Prompt
After Opening Command prompt type following command aspnet_regiis.exe -pef “connectionStrings” “C:\VisualStudio2008\Authorization”
After that you will get a message stating “Encrypting configuration section… Succeeded!”.
Now when you will open your web.config file you will find encrypted connection string.