Home > .Net Framework 3.5, ASP.Net 3.5, ASP.Net 4.0, Visual Studio 2010 > Encrypt Connection String in web.config

Encrypt Connection String in web.config

Never keep clear plain connectionstring in web.config file. The risk and consequences of this is self expalanatory. All you need to do is follow below steps and you are through with this.

Steps to be followed.

 

  1. Go to Visual Studio Command prompt in the “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\”path.
  1. Encrypt Web.Config connectionStrings using below command;
  1. aspnet_regiis -pef “connectionStrings” path of the physical folder where web.config resides (e.g. aspnet_regiis -pef “connectionStrings” D:\ProjectName)
  1. You will get the message “Encrypting configuration section… Succeeded!”
  1. Run Following Commands;
  1. aspnet_regiis -pa “NetFrameworkConfigurationKey” “ASPNET”
  1. aspnet_regiis -pa “NetFrameworkConfigurationKey” “NETWORK SERVICE”
  1. aspnet_regiis -pa “NetFrameworkConfigurationKey” “NT AUTHORITY\NETWORK SERVICE”
  1. Restart IIS
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: