I need the following setup:
connectionStrings
config section to be encrypted via aspnet_regiis
<add>
elements, where the value just contains some placeholder text. My reasoning is:
Is this possible using config transformations?
The only examples I can find transform individual connection string elements, but I need the entire section to look different depending on debug/release settings.
Appreciate any advice
I managed to do this with the help of this useful post :
<connectionStrings xdt:Transform="RemoveAttributes(configProtectionProvider)">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#" xdt:Transform="Remove" xdt:Locator="Match(Type)" />
<add xdt:Transform="Insert" name="CDSsvcUsername" connectionString="username"/>
<add xdt:Transform="Insert" name="CDSsvcPassword" connectionString="password"/>
</connectionStrings>
So I'm calling xdt:Transform="Remove"
on the entire Encrypted
element as well as removing the configProtectionProvider
attribute on connectionStrings
.
This only worked after specifying xdt:Locator
in the remove transformation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.