Question

I'm using a resource file to store the database connection string. This was successfully deployed in {SharePointRoot}\Resources\. I tried editing the file and change some of the values just to test it but it's not getting the current value on the XML file instead it's still using the old value. I searched for any resource file in case it was saved somewhere else but I found none. Why is my web part still using the old connection string? I refreshed the page several times.

Old value:

 <data name="HBConnectionString" xml:space="preserve">
        <value>Data Source=DevServer;Initial Catalog=db;user=user;password=pwd;Pooling=false;</value>
        <comment>HelpBox connection string</comment>
      </data>

new value:

 <data name="HBConnectionString" xml:space="preserve">
            <value>Data Source=TestServer;Initial Catalog=db;user=user;password=pwd;Pooling=false;</value>
            <comment>HelpBox connection string</comment>
          </data>
Was it helpful?

Solution

You should not store database connection strings in Resource files.

SharePoint 2010 has a new feature that can be used for this. It is called Secure Store Service.

Read this guide MSDN to get it working

OTHER TIPS

Depending on where you store your resources you need a different approach:

  • {SharePointRoot}\config\resources - These are copied to the wwwroot by issuing the following command: stsadm -o copyappbincontent
  • {SharePointRoot}\resources (your situation) - Requires an iisreset as these files are cached.

You might need to do an IISReset between making changes to SharePointRoot

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top