Asp.net 如何加密链接到web.config的文件

Asp.net 如何加密链接到web.config的文件,asp.net,encryption,aspnet-regiis.exe,Asp.net,Encryption,Aspnet Regiis.exe,我有一个web.config文件,它链接到一个common.config文件。多个应用程序正在使用common.config。我使用了aspnet_regiis.exe,但它只加密web.config文件。如何加密common.config文件 web.config文件: <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings file="C:\Users\naem\Document

我有一个web.config文件,它链接到一个common.config文件。多个应用程序正在使用common.config。我使用了aspnet_regiis.exe,但它只加密web.config文件。如何加密common.config文件

web.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings file="C:\Users\naem\Documents\common.config" />
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="myKey" value="This is the Value!!!!"/>
  </appSettings>
common.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings file="C:\Users\naem\Documents\common.config" />
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="myKey" value="This is the Value!!!!"/>
  </appSettings>

我没有代表对原始帖子发表评论,但这看起来像是我找到的解决此问题的方法的副本。希望能有帮助

暂时将common.config重命名为web.config

将配置作为根元素添加到此文件。因此,您的common.config如下所示

运行加密命令

aspnet_regiis.exe-pef appSettings C:\Users\naem\Documents

打开加密文件并删除配置标记

将文件重命名为Common.config


嗯,那没有答案。你为什么把这当作回答而不是评论呢;我在这里还是新手,所以我不知道如果几天前创建的原始线程没有得到响应,那么创建重复线程是允许的,尽管那里有答案和评论。如果你读了我的答案,我已经回答了你的问题,为什么我没有发表评论。至少需要50名代表对一篇原创文章发表评论,我还没有。可能是重复的