In this post we will learn how to encrypt connection string in web.config
Implementation
- RunDeveloper Command Prompt for VS2013 as Administrator
- Change directory to Microsoft .NET Framework Folder
- Choose .Net framework folder v4.0.30319
- Create a website in the IIS
- Register your web application using aspnet_regiis command
Developer Command Prompt for VS2013
Encrypt Web Config
Now look at Encrypted web config file
web config encrypt
Encrypt Connection String in web.config Commands
C:\Windows\system32>cd..
C:\Windows>cd Microsoft.NET
C:\Windows\Microsoft.NET>cd Framework
C:\Windows\Microsoft.NET\Framework>cd v4.0.30319
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -site "EncryptDemo" -app "/" -pe "connectionStrings"
aspnet_regiis.exe -site "NameoftheSite" -app "/" -pe "EncryptingTag"
Decrypt Connection String in web.config Commands
From the above command change -pe to -pd to decrypt
aspnet_regiis.exe -site "EncryptDemo" -app "/" -pd "connectionStrings"
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -site "EncryptDemo" -app "/" -pd "connectionStrings"
The post Encrypt Connection String in web.config appeared first on Venkat Baggu Blog.