'How to decrypt a connectionString in a web.config using regiis_asp.net?

I have tried using this command in cmd but it didn't work

c:/path.../regiis_asp.net -pi "connectionString" -app "d:/myWebSiteApp" 

the result of that command was

the configuration section "connectionString" was not found
failed


Solution 1:[1]

Have you tried it this way?:

Encrypt:

aspnet_regiis.exe -pef "connectionStrings" C:\path\to\application

Decrypt:

aspnet_regiis.exe -pdf "connectionStrings" C:\path\to\application

Solution 2:[2]

If your intention is to decrypt the connectionStrings section in the web.config, you will have to use the below command.

aspnet_regiis -pdf "connectionStrings" -app "d:/MyWebsiteApp"

Note: in the code provided by you, please note the following

1) the utility command is aspnet_regiis instead of regiis_asp.net

2) Since your app is referred from the physical path, the container configuration must be -pdf instead of -pi

3) The section name is connectionStrings instead of connectionString ( notice the 's')

If you are trying to decrypt from the virtual path then the command must be as below

aspnet_regiis -pd "connectionStrings" -app "/MyWebsiteApp"

Solution 3:[3]

Just had this and it turned out that it didn't want the double quotes around connectionStrings.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 James Johnson
Solution 2 clklachu
Solution 3 SteveCav