简体   繁体   English

ASP.NET连接字符串加密

[英]ASP.NET connection string encryption

The answers I found to this issue didn't seem to work. 我发现的这个问题的答案似乎没有用。 This is a difficult item to find information about on MSDN and in general. 通常,这是一个很难找到有关MSDN的信息的项目。

I am using Windows Server 2003, IIS 6, Dot.Net 3.5 and Visual Studio 2008. 我正在使用Windows Server 2003,IIS 6,Dot.Net 3.5和Visual Studio 2008。

I need to know how to encrypt a connection string for an Asp.Net web application. 我需要知道如何加密Asp.Net Web应用程序的连接字符串。

Below is my solution to this for Windows Server 2003 and IIS 6 and .Net 3.5 and Visual Studio 2008. Since the encryption is machine-specific, it HAS to be run on the web server. 下面是我的解决方案,这对于Windows Server 2003和IIS 6和.NET 3.5和Visual Studio 2008由于加密机专用的,它必须是在Web服务器上运行。

Encryption Command (change PROJECT_NAME to your web app folder name): 加密命令(将PROJECT_NAME更改为您的Web应用程序文件夹名称):

c:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\aspnet_regiis -pef "connectionStrings" "C:\\inetpub\\wwwroot\\PROJECT_NAME" c:\\ Windows \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ aspnet_regiis -pef“ connectionStrings”“ C:\\ inetpub \\ wwwroot \\ PROJECT_NAME”

The second command gives the ASPNET account access to the NetFrameworkConfigurationKey in machine.config. 第二个命令使ASPNET帐户可以访问machine.config中的NetFrameworkConfigurationKey。

c:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET" c:\\ Windows \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ aspnet_regiis -pa“ NetFrameworkConfigurationKey”“ ASPNET”

The third command gives the NT Authority\\Network Service account access to the NetFrameworkConfigurationKey. 第三个命令使NT Authority \\ Network服务帐户可以访问NetFrameworkConfigurationKey。

c:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT Authority\\Network Service" c:\\ Windows \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ aspnet_regiis -pa“ NetFrameworkConfigurationKey”“ NT Authority \\ Network Service”

I hope this helps someone. 我希望这可以帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM