Sunday, August 19, 2012

Encrypt and Decrypt Connection Strings in Web.Config

Encryption and Decryption using Web.Config

File->New->WebSite



Go to web.config file and write the following code.








<connectionStrings>
    <add name="dbemployee" connectionString="Data Source=localhost; user id=sa;password=uday; database=uday"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

Now go to Visual Stdio CommandPrompt and type the following to encypt the web.config file.

aspnet_regiis.exe -pef "connectionStrings" path of the file

Eg: aspnet_regiis.exe -pef "connectionStrings"  C:\Users\uday\Documents\WebSite3














here pef indicates file system website.

Now go to web.config and see the web.config file with the encrypted code

Web.config






















Decrypt the Connection String

Now go to Visual Stdio CommandPrompt and type the following to decrypt the web.config file

aspnet_regiis.exe -pdf "connectionStrings" path of the file

Eg: aspnet_regiis.exe -pdf "connectionStrings"  C:\Users\uday\Documents\WebSite3














Web.config




No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...