我已经尝试用下面的代码加密,但它只能在我的PC上使用,其他PC无法连接到我PC中的SQL server。有没有人帮我?非常感谢!(我也尝试过aspnet_regiis.exe,但也遇到了同样的问题)
public static void ProtectSection(String sSectionName)
{
Configuration config = ConfigurationManager.OpenExeConfiguration("TFLManager.exe");
// Get the section in the file.
ConnectionStringsSection section = config.GetSection(sSectionName) as ConnectionStringsSection;
// If the section exists and the section is not readonly, then protect the section.
if (section != null)
{
if (!section.IsReadOnly())
{
// Protect the section.
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
section.SectionInformation.ForceSave = true;
// Save the change.
config.Save(ConfigurationSaveMode.Modified);
}
}
}发布于 2018-05-13 14:21:40
在所需的计算机上以管理员身份启动命令提示符。在命令提示下,输入:
cd C:\Windows\Microsoft.NET\Framework\v4.0.30319如果您的web配置位于"D:\Code\EncryptWebConfig“目录路径中,请输入以下内容以加密ConnectionString:
ASPNET_REGIIS -pef "connectionStrings" "D:\Code\EncryptWebConfig"https://stackoverflow.com/questions/33623442
复制相似问题