Buddhika Samith
Buddhika Samith

Reputation: 295

How to encrypt Connection Strings credentials in Web.Config file in ASP.Net

I'm working on asp.net project I have to encrypt credential in web.config file

<add name="ConnectionString"
     connectionString="Data Source=sqlexpress;
                       Initial Catalog=Employee;
                       User ID=testUser;
                       Password=testPassword"
     providerName="System.Data.SqlClient"/>

Upvotes: 0

Views: 709

Answers (1)

hutchonoid
hutchonoid

Reputation: 33326

You can use aspnet_regiis to do this.

As an example:

aspnet_regiis -pe "connectionStrings" -app "/SampleApplication" -prov "RsaProtectedConfigurationProvider"

Encrypting and Decrypting Configuration Sections

Upvotes: 1

Related Questions