Reputation: 4866
I know you can encrypt sections of Web.config and App.config but I have a .NET application from a vendor that uses a custom config file (ie, myApp.config) that has a similar structure to a .NET config file. Can you use the same methods with aspnet_regiis to encrpyt this file too?
Upvotes: 0
Views: 866
Reputation: 46
aspnet_regiis is designed for .NET configuration files and your custom file would need to have the same structure as a web.config file, including a top-level configuration node. An alternative approach is to limit access using NTFS file permissions and Encrypting File System (EFS). The ApplicationPoolIdentity in IIS would need NTFS permissions in that case.
Upvotes: 1
Reputation: 4866
You cannot do this unless it follows the same structure as Web.config. First, as shown in the link Mark H provided, there is a hack of renaming your file to Web.config, doing the encryption, then renaming the file to the original name. Unfortunately, I do not have a configuration node, which leads to this error:
While I can add a configuration node, that will affect the original app so it will not work.
Upvotes: 0
Reputation: 31
Most of the articles I have found specifically mentioned encrypting asp.net configs but there are some articles that describe how to encrypt custom configs as well.
Here is one example with a thorough description of the entire process:
https://www.c-sharpcorner.com/article/encrypting-app-config-for-multiple-machines/
Hope that helps!!!
Upvotes: 0