I know that ppl have already asked questions regarding encrypting web.config.
im also trying to encrypt my test config file, but im getting this error.
aspnet_regiis -pef "connectionStrings" "C:\encryptedWeb.config" Encrypting configuration section... The configuration for physical path 'C:\EncryptedWeb.config' cannot be opened. Failed!
I just want to know, what could be reasons that it failed.
I got the answer, it was the readonly property of the web.config which was the problem. After I removed the readonly It worked like a charm.
Encrypting a Web Configuration Section To encrypt configuration file contents, use the Aspnet_regiis.exe tool with the –pe option and the name of the configuration element to be encrypted. Use the –app option to identify the application for which the Web.
for the command "aspnet_regiis -pef" the path of configuration file is the physical path (Not virtual) and also it is the path of directory/folder where web.config resides. So one should not include the name of file in path e.g.
if your web.config path is at D:\MyConfiguration\web.config
then while encrypting/decrypting you will use it as follow:
encrypt:
aspnet_regiis -pef [sectionName] "D:\MyConfiguration"
decrypt:
aspnet_regiis -pdf [sectionName] "D:\MyConfiguration"
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