0
votes

I am trying to use ASPNET_RegIIS.exe to encrypt the <applicationSettings> section in web.config. I ran Visual Studio Developer Command Prompt as Administrator, and CD to the web application's folder when the web.config is in. Then I ran the command:

aspnet_regiis.exe -pdf "applicationSettings" .

The result I get was:

Decrypting configuration section...
The configuration section 'applicationSettings' was not found.
Failed!

I definitely have the <applicationSettings> section in the web.config file. So I tried to use the same syntax to encrypt different sections and gathered the results:

<configSections> Failed.
<appSettings> Success.
<connectionStrings> Success.
<system.web> Failed.
<runtime> Failed.
<system.codedom> Success.

So I thought, maybe ASPNET_RegIIS.exe can only encrypted a set of pre-defined section names. To that, I tested by creating a new section with random name.

<applicationSettingsConax>

To my surprise, it was able to encrypt it! So then I thought, maybe its the settings inside <applicationSettings> that's causing the problem. So I copied all the settings from <applicationSettings> into <applicationSettingsConax> and it was still able to encrypt <applicationSettingsConax>.

Now I'm really puzzled. why ASPNET_RegIIS.exe cannot encrypt many of the sections in web.config, but can encrypt sections with randomly created names?

(Yes, I've Googled and found no information. I've read the official MS page https://docs.microsoft.com/en-us/previous-versions/aspnet/zhhddkxy(v=vs.100), and it doesn't say much there either. No surprise there.)