Tom Marienfeld
Tom Marienfeld

Reputation: 716

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?

Upvotes: 0

Views: 1626

Answers (2)

Rahul
Rahul

Reputation: 77856

Either way you will have to provide those credentials. You can pass them in connection string in your code (OR) can have those maintained in web.config or app.config file in which case you can actually encrypt the password and have the encrypted value mentioned in connection string.

Upvotes: 0

Aaron
Aaron

Reputation: 846

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

Upvotes: 1

Related Questions