5

I've been using web.config transforms with good success. I've just recently implemented connection strings encryption and am unsure how to modify my Release transform.

Before hand I was simply replacing the setting by using the locator for name.

Now that the settings are encrypted, there is no name.

<connectionStrings configProtectionProvider="Pkcs12Provider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
  xmlns="http://www.w3.org/2001/04/xmlenc#">
  <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes192-cbc" />
  <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
    <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
      <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
        <KeyName>rsaKey</KeyName>
      </KeyInfo>
      <CipherData>
        <CipherValue>CipherValueHere</CipherValue>
      </CipherData>
    </EncryptedKey>
  </KeyInfo>
  <CipherData>
    <CipherValue>CipherValueHere</CipherValue>
  </CipherData>
</EncryptedData>

How can I update my transform to replace the entire connection strings section with this? Is there a locator for the element name "connectionStrings"?

Many thanks, John

2 Answers 2

7

To replace entire connectionString section use the below code

<connectionStrings xdt:Transform="Replace">

xdt:Transform="Replace" Will do the trick. Cheers!!

Sign up to request clarification or add additional context in comments.

Comments

4

Never mind, if you leave out the Locator it automatically applies it to the element.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.