title: App.config connection string Protection error
body: <p>I am running into an issue I had before; can't find my reference on how to solve it.</p>
  
  <p>Here is the issue. We encrypt the connection strings section in the app.config for our client application using code below:</p>
  
  <pre><code>        config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
          If config.ConnectionStrings.SectionInformation.IsProtected = False Then
              config.ConnectionStrings.SectionInformation.ProtectSection(Nothing)
  
              ' We must save the changes to the configuration file.'
              config.Save(ConfigurationSaveMode.Modified, True)
          End If
  </code></pre>
  
  <p>The issue is we had a salesperson leave. The old laptop is going to a new salesperson and under the new user's login, when it tries to to do this we get an error. The error is:</p>
  
  <pre><code>Unhandled Exception: System.Configuration.ConfigurationErrorsException: 
  An error occurred executing the configuration section handler for connectionStrings. ---&gt; System.Configuration.ConfigurationErrorsException: Failed to encrypt the section 'connectionStrings' using provider 'RsaProtectedConfigurationProvider'. 
  Error message from the provider: Object already exists.
  ---&gt; System.Security.Cryptography.CryptographicException: Object already exists
  </code></pre>