How to hide app.config file password?

0

Whenever I'm going to create a new stringconnection, VisualStudio asks me if I want to leave the password visible in the app.config file

I always answer yes, because I do not know how to enter it directly via code.

How can I delete this password from the file and make the connection at run time thus preventing anyone from opening the app.config file and see the password there?

I'm using Visual Studio 2015, Entity Framework 6 and MySql

    
asked by anonymous 09.04.2017 / 15:39

1 answer

3

You can encrypt the connection string by using the aspnet_regiis utility located at % systemroot% \ Microsoft.NET \ Framework \

In case to encrypt the section connectio strings the command would be aspnet_regiis -pe "connectionStrings" -app "/ SampleApplication" where "SampleApplication" is the name of your application.

So the Framework itself will read the connection string.

More information here and the CodeProject

    
27.04.2017 / 14:39