"aspnet_regiis -pef " command removes " <configSections>" section of web.config
Asked Answered
S

1

0

I am using the following command to use a machine key to encrypt part of my web.config (it is actually an app.config for a .net app, renamed to web.config so the aspnet_regiis will work with it):

aspnet_regiis -pef "section-to-encrypt" "C:\inetpub\path-to-web.config\bin\Release" -prov "provider-name"

Before running this, I add the section < configProtectedData>, which seems to be required (to hook "provider-name" to machine crypto, it appears).

Problem: After running the above command, the < configSections> is removed from the .config file, damaging it.

What am I doing wrong?

Saury answered 6/9, 2016 at 14:48 Comment(0)
I
-1

I had a similar issue which I just resolved. If I insert the configProtectedData. section before the configSections section it was wiping out configSections. If I added it after the configSections section it does not.

I'm encrypting a regular web.config file but I don't believe that difference matters.

Illene answered 20/10, 2016 at 19:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.