User and password are included inside the code.

I wrote a WinForm application using C #. The application must be connected to the database, so it contains a code, for example:

String connstring = String.Format("Server={0};Port={1};" + "User Id={2};Password={3};Database={4};", "localhost", "3456", "username", "password", "databasename" ); 

This means that the user and password of the database server are included inside the application. I think this is not a safe way. Is there a way to improve security?

+4
source share
3 answers

You can add an encrypted connection string to your app.config.

For more information: Protecting Connection Strings

+3
source

You can save them in a local file, and then use system permissions to make it difficult to change it.

0
source
  • Ignore this problem.
  • Allows user to enter database username / password
  • Do not connect to the database, but connect to the Http service, so you do not miss the password to connect to the database in any way.
0
source

Source: https://habr.com/ru/post/1447270/


All Articles