Search code examples
c#mysqlauthenticationwebserver

Use password in MySql connection string? C#


If I want to make a C# login form, with a Mysql databse which provides the userdata, in c#, i would say it's unsafe to write the database password, database username and database name in the connection string. Am i right? And is there another way like a webserver which will connect to the database and check if userdata is right?


Solution

  • You should store such things in a configuration file. .NET has the option to use encryption in web.config / app.config.

    https://msdn.microsoft.com/en-us/library/ms254494(v=vs.110).aspx#Anchor_2