I am using a PowerShell script to automatically encrypt certain sections of my web.config after deploying my WebApplication using Release Management. In this PowerShell script I make use of aspnet_regiis.exe to perform the encryption for me as follows:
$AspNetRegIisLocation = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe"
& $AspNetRegIisLocation -pef $configSection $configPath
With the $configSection
and $configPath
being correctly defined, as the encryption is working successfully. Sadly it causes the euro sign in one of the unencrypted sections to be corrupted from <sharedSettings currencyFormat="{0:€ #,##0}" />
to <sharedSettings currencyFormat="{0:€ #,##0}" />
.
I have tried escaping the euro sign as €
and setting the encoding="utf-8"
both on and off at the top of my web.config. Neither of those solutions worked and I'm at a bit of a loss what I can do to prevent this from occurring again, apart from making the script copy all the sections prior to encrypting and reinserting the unencrypted sections afterwards.
edit: When this section is also encrypted, the displayed text on the website is also 'corrupted', which means that the solution of 'insert the unencrypted sections later' would not solve the case where the problem occurs in an encrypted section.