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
Decrypting a Web Configuration Section To decrypt encrypted configuration file contents, you use the Aspnet_regiis.exe tool with the -pd switch and the name of the configuration element to be decrypted. Use the –app and -site switches to identify the application for which the Web. config file will be decrypted.
To read the connection string into your code, use the ConfigurationManager class. string connStr = ConfigurationManager. ConnectionStrings["myConnectionString"].
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
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With