I have an C# WPF programm written in C# with Visual Studio. In it there's an SQL Connect Class, which gets the ConnectionString from a config file:
ConnectionStringSettingsCollection SQLString =
ConfigurationManager.ConnectionStrings;
string connectionString = "";
if (SQLString != null)
{
foreach (ConnectionStringSettings cs in SQLString)
{
connectionString = cs.ConnectionString;
}
}
connection = new MySqlConnection(connectionString);
The Connection string is in a seperate config:
<connectionStrings>
<add name="SQLServer"
providerName="System.Data.ProviderName"
connectionString="SERVER=my.domain;DATABASE=myDB;UID=myUser;PASSWORD=myPassword;" />
As far as I understand it, you shouldn't put passwords into the compiled code. I've hear that you can encrypt config files. How can I do this? Could someone provide a step by step example?
Thanks!