Encrypting Nlog Section Of web.config

How to Encrypt ElasticSearch password details?

The web.config file contains sensitive information that one may want to secure. It is possible to encrypt indicated sections in this file with the help of the Aspnet_regiis.exe tool.

Encrypting Web Config Section , will provide guidance on how to encrypt most of the sections. However the Nlog configurations need little tweaking in order to encrypt.

To encrypt configuration section with sub-target like system.web/sessionState follow steps:

  1. Open the Command Prompt.

  2. Change the directory to the location of the Aspnet_regiis.exe tool.

  3. Add the following command aspnet_regiis -pe "system.web/sessionState" -site "UiPathOrchestrator2018.2" -app "/" -prov "RsaProtectedConfigurationProvider"

To encrypt configuration section with more than 1 sub-target like nlog follow steps:

  1. Copy the file Nlog.dll from C:\Program Files (x86)\UiPath\Orchestrator location to the folder where aspnet_regiis.exe is located

  2. aspnet_regiis.exe is usually located in %SystemRoot%\Microsoft.NET\Framework\versionNumber. For example: C:\Windows\Microsoft.NET\Framework\v4.0.30319

  3. Now follow the same steps as we were following for configurations with single target. Open the Command Prompt

  4. Change the directory to the location of the Aspnet_regiis.exe tool

  5. Add the following command aspnet_regiis -pe nlog -site "UiPathOrchestrator" -app "/" -prov "RsaProtectedConfigurationProvider"

This will encrypt the whole nlog section.



To decrypt the same nlog section follow steps:

  1. Copy the file Nlog.dll from C:\Program Files (x86)\UiPath\Studio location to the folder where aspnet_regiis.exe is located
  2. Open the Command Prompt
  3. Change the directory to the location of the Aspnet_regiis.exe tool
  4. Add the following command aspnet_regiis -pd nlog -site "UiPathOrchestrator" -app "/".