Reputation: 53
Is it possible to encrypt the web.config before deployment and distribute it to the target machine without the possibility to decrypt it?
We want to hide the connection string so that the administrator cannot see the con string.
Upvotes: 0
Views: 564
Reputation: 1
Yes you can encrypting the Connection Strings section in Web.Config file.
You need to follow the following steps:
1.Open Visual Studio Command Prompt You will need to open the Visual Studio Command Prompt from the Start Menu => Programs => Microsoft Visual Studio 2010 => Visual Studio Tools => Visual Studio Command Prompt.
2.Encrypting the Connection Strings section in Web.Config using aspnet_regiis.exe tool In order to encrypt the ConnectionString section in the Web.Config file, we will need to use the aspnet_regiis.exe tool.
Syntax:
aspnet_regiis.exe -pef "connectionStrings" ""
Example:
aspnet_regiis.exe -pef "connectionStrings" "D:\Sai\Projects\MyTestWebsite".
You can refer to this document for full information: https://microsoftdotnetsolutions.blogspot.com/2018/11/encrypt-and-decrypt-of-connection.html
Upvotes: 0
Reputation: 29668
You can encrypt configuration, see here for a full walkthrough:
http://msdn.microsoft.com/en-us/library/dtkwfdky(v=vs.100).aspx
Of course, the target machine will still have to decrypt it one way or another, but I assume you just mean them opening up Web.config in say Notepad and having a jolly.
Upvotes: 1