How do I Secure My Connection String In web.config file

Go to start , search for Windows Explorer
Right click on windows explorer, and then select Run as an Administrator.
Go to C: drive , Go to Tools Menu , Select Folder Options , in View tab
Click show hidden files, folder and drives.
Now , you will able to see ProgramData (hidden folder)
Now Go this path C:\ProgramData\Microsoft\Crypto\RSA, you will get MachineKeys Folder
For accessing MachineKeys folder you must have full access control as a user.
Right click MachineKeys folder, select properties, then go to security tab.
In Group or User names, select everyone, for permission, click edit to provide full access to it.
Check all under Allow permission checkboxes then click OK again click Apply and OK button for
completion of permission to user everyone.
After providing access permission to everyone user, go to run, type CMD.
Go to path , C:\Windows\Microsoft.NET\Framework\v4.0.30319 ,copy path and paste in CMD
In CMD, type CD <space> C:\Windows\Microsoft.NET\Framework\v4.0.30319, then follow the
encryption command along this, for encryption the connectionString in web.config.
See below line.

C:\Windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis.exe <space> -
pef “connectionStrings” <space> “D:\Sunil\Project\Telebrands_30_Nov_2011”

For decryption the connectionString in web.config.

C:\Windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis.exe <space> -
pdf “connectionStrings” <space> “D:\Sunil\Project\Telebrands_30_Nov_2011”

Note: kindly take web.config backup separately if something happens unexpectedly.
To run above commands, you must have access to your server with MSTSC credentials
CMD – Command Prompt
MSTSC – Remote Login

Comments

Popular posts from this blog