What is the best place to store the connection string?

Asked

Viewed 519 times

6

There are some possible places to store the string connecting. Leave tied inside the code, app.config, Windows registry and configuration file.

What is the best place to store string connection? Based on issues, security, performance.

2 answers

5


The best is to have the basic setup on app.config (eventually web.config) and not put passwords in it.

But if you do, what do you do using encryption. Placing passwords exposed, especially, is reckless. It’s best to use authentication integrated with the operating system or authentication made with user and password requested in the application and not available anywhere in it.

Of course some situations may ask for a different solution.

Doing this will be safe as far as it can be safe. Performance is not relevant to this, if it doesn’t do anything crazy, but even the worst programmers don’t usually do crazy things with it.

  • 1

    I’m deleting the comment, it was little thing to fix nor would allow me to make the correction.

1

You can store your Connection strings in his app config. , taking into account that this involves security risks, I advise to read the following article, which helps us to have a good practice:
Connectionstrings - MSDN

You can also encrypt your connection string and continue to store it the same way in the same configuration file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.