SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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

I'm writing an application page in SharePoint and I want to securely store the connection string. I've used a variety of methods before but they all seem a little "suspect". What is the recommended approach for securely storing connection strings in SharePoint?

If the answer is in the web.config, what is the recommended way for managing the values here?

share|improve this question
up vote 4 down vote accepted

I would not recommend to store any custom application settings in the web.config! Consider using a custom SPPersistedObjects as explained by Wictor Wilén in Six ways to store settings in SharePoint

If your connection string needs a username and password to the backend system then you should also think about using the Secure Store Service. It provides a secure way of storing and mapping user credentials.

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.