Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

I am using Windows Server 2003, IIS 6, Dot.Net 3.5 and Visual Studio 2008.

I need to know how to encrypt a connection string for an Asp.Net web application.

share|improve this question
1  
You should separate this into a question and an answer. –  SLaks Jul 17 '13 at 19:05
 
You may want to pose this as a question then answer it and accept it. –  AmitApollo Jul 17 '13 at 19:05
 
Thanks SLaks and AmitApollo. I have done that. –  user1464673 Aug 15 '13 at 16:19
add comment

1 Answer

up vote 0 down vote accepted

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.

Encryption Command (change PROJECT_NAME to your web app folder 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.

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.

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

I hope this helps someone.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.