Phone: 407-551-0777 
Home Contact Support Privacy
  Home
  Purchase
  Features
  System Requirements
  Preview Demo
  Support
  Installation
  FAQ's
  Our Clients
  What's New
  Affiliate Program
  Resources
  Contact Us

How do I encrypt the asp.net database connection string in the web.config file?

  To encrypt the connection string section follow the steps,

1.  Launch a command prompt.  You can do this using Start/Run and entering CMD.

2. Switch to the folder where .net 4 is installed.  For example:

    cd C:\Windows\Microsoft.NET\Framework\v4.0.30319

3. Type following command,

    aspnet_regiis.exe -pef “connectionStrings” C:\inetpub\wwwroot\enewsletterpro

    -pef indicates that the application is built as File System website.  The second argument is the name of configuration section needs to be encrypted. Third argument is the physical path where the web.config file is located.

   If eNewsletter Pro is installed as a sub folder of a web site, then you can use,

   aspnet_regiis.exe -pe “connectionStrings” -app “/eNewsletterPro”

 -pe indicates that the application is built as IIS based site. The second argument is the name of configuration section needs to be encrypted. Third argument “-app” indicates virtual directory and last argument is the name of virtual directory where application is deployed which in this case is eNewsletterPro.   

   If everything goes well you will receive a message “Encrypting configuration section…Succeeded!”

  Open your web.config file and you can see that connection string is encrypted,

   1: <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
   2:   <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
   3:    xmlns="http://www.w3.org/2001/04/xmlenc#">
   4:    <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
   5:    <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
   6:     <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
   7:      <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
   8:      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
   9:       <KeyName>Rsa Key</KeyName>
  10:      </KeyInfo>
  11:      <CipherData>
  12:       <CipherValue>Ik+l105qm6WIIQgS9LsnF8RRxQtj2ChEwq7DbHapb440GynFEoGF6Y3EM3Iw/lyDV8.......kLFC0=</CipherValue>
  13:      </CipherData>
  14:     </EncryptedKey>
  15:    </KeyInfo>
  16:    <CipherData>
  17:     <CipherValue>JsLrQ5S8Pq3U72nQzmSl/XlLX72GM0O3EbPLaHRNvjTDgG9seDflGMjTfO10M1s.......</CipherValue>
  18:    </CipherData>
  19:   </EncryptedData>
  20:  </connectionStrings>

 

Now should you need to decrypt the configuration section in web.config file use following command,

For File System Application,

aspnet_regiis.exe -pdf “connectionStrings” C:\inetpub\wwwroot\enewsletterpro

For IIS based Application

aspnet_regiis.exe -pd “connectionStrings” -app “/eNewsletterPro”

 

AdComplete.com, LLC
Phone (407) 551-0777 
Copyright (c) 2001-2011
AdComplete.com, LLC  All Rights Reserved.

AdComplete.com Specializes in Internet Advertising and Marketing Software Solutions
including Affiliate Program Software, Email Marketing Software and Ad Server software.