Saving the connection string in the database

I could not find a question that would fit this purpose, so I ask for it.

We have deployed an ASP.NET website with two connection strings, one of which can be configured by the user at runtime. The problem is that since I use the .NET Framework for this, it creates a temporary file at the time the web.config changes, which forces my client to grant full rights to the entire folder of the website, not just the website. configuration file. He is not happy with this, and the manager asks about saving another connection string in the same configuration file.

So, I have options for creating a separate configuration file in a separate folder so that they can only provide full rights to this folder or store them in the database. The first option is about the same as now, so the question is:

How about storing ConnectionString in the database?

Please note that I am not talking about the ConnectionString application, but an alternative, since this application will be integrated as three applications.

So guys, give me the advantages and disadvantages, the good and bad points of storing it in a database.

+3
source share
4 answers

I will not store connection strings in the database.

( , web.config).

(, ..), , , .

+5

, 2- , , , . - ?

, . , ( ), , .

+6

DB

, DB . .

  • , , ISAPI ASP.net , , .
  • - , .
  • No security issues - no need to set any special permissions anywhere
+2
source

You can use something like this on your website

<add name="ConnectionString" connectionString="Data Source={0};Initial Catalog={1};User ID={2};Password={3}" providerName="System.Data.SqlClient" />

And then use string.Format () to set different values ​​for each parameter.

-1
source

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


All Articles