i am siva

Empty your memory, with a free()... like a pointer! <br /> The pointer can crash...and can overflow..!

Encrypt or Decrypt Connection Strings in web.config

May 5, 2015

Deploy applications in hosting environment we have to take care of application security items or confidential values of application like secure DB connection string, configuration values etc… To secure all these information, we need to encrypt the keys. 
ASP.NET 2.0 has built in functionality to encrypt / decrypt few sections of web.config file those are 
RSAProtectedConfigurationProvider: This is default provider and uses the RSA public key encryption algorithm to encrypt and decrypt data.
DataProtectionConfgurationProvider: This provider uses windows data protection application programming interface to encrypt and decrypt the data. 
Encrypt or Decryprt connection strings in web.config file can be done by using aspnet_regiis.exe command line or code behind using configuration providers. First will see using command line statements.
Encrypt/Decrypt using aspnet_regiis
First we will do Encrypt/Decrypt in File System Website
First create one sample website in visual studio, then add a sample connection string in web.config file like this
 

<connectionStrings> <add name=”Server=192.168.1.2;Database=ischool;Uid=root;Pwd=root;” connectionString=”SampleConnectionString” providerName=”MySql.Data.MySqlClient” /> </connectionStrings>
 
Then open visual studio command prompt if you are using windows 7 select Run as Administrator. In command prompt type the following command

C:\Program Files\Microsoft Visual Studio 10.0\VC>aspnet_regiis -pef “connectionStrings” “D:\Siva\R&D\DotNet\ASPNET\WebSite2”
Here

  • 3Share on Facebook
  • 0Share on Twitter
  • 0Share on Pinterest
  • 0Share on LinkedIn
  • 0Share on WhatsApp
  • 0Share on Email
Posted in: .NET, ASP.NET, C#, Dot Net Tagged: .NET, ASP.NET, C#, Dot Net

Tags

.NET ASP.NET Azure DevOps C# Design Patterns Dot Net GoF SharePoint SqlServer TFS Visual Studio VS Windows WPF

Categories

  • .NET
  • ASP.NET
  • Azure DevOps
  • C#
  • Design Patterns
  • Dot Net
  • GoF
  • SharePoint
  • SqlServer
  • TFS
  • Uncategorized
  • Visual Studio
  • VS
  • Windows
  • WPF

Archives

  • August 2020
  • August 2019
  • May 2015
  • March 2013

Recent Comments

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Copyright © 2021 i am siva.

    Me WordPress Theme by themehall.com