SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Server One: OS Windows Server 2008 + MS SharePoint 2010;
Server Two: OS Windows Server 2008 + MS SQL Server 2008

I need to encrypt the connection string in web.config on Server One to connect to Server Two.

share|improve this question

here are simple steps to perform for securing and encrypting the connection strings. Remember we should encrypt all connection strings mentioned in connectionstring tag in web.config.

Remember that encryption happens on the basis of RSA provider.

Open the visual studio command prompt. Type in this commend

aspnet_regiis -pe "connectionStrings" -app "/SPKings"

Where SPkings is the web application and here is the result of this encryption. enter image description here After this encryption, you do not need to perform any decryption in your code. Runtime will automatically decrypt this connectionstring for you. There will be very light performance issue, very light, However this is okay according to me instead of opening the username, password or server name and database name to any other person.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.