1
votes

I am trying to encrypting appSettings in a external file using aspnet_regiis -pef. Does anyone how how to do this.

My main web config file :

 <appSettings file="ExternalAppSettings.config">
    <add key="test1" value="val1" />
    <add key="test2" value="val2" />   
  </appSettings>

external file ExternalAppSettings.config

 <appSettings>
    <add key="pwd1" value="test1" />
    <add key="pwd2" value="test2" />
</appSettings>

I want to encrypt only appsetting in ExternalAppSettings.config how to do this ?

2

2 Answers

0
votes

I have done this type of work. I just encrypt the string and than put encrypted string in the values. when i retrieve the values i will again decrypt it into original values.

0
votes

Please try the below.

aspnet_regiis -pe "appSettings" -prov "{0}" -site {1} -app "/"

example: aspnet_regiis -pe "appSettings" -prov "DataProtectionConfigurationProvider" -site "1" -app "/virtualdirectory_name"

{0}: encryption provider

{1} : Site id in IIS