Is it correct to make connection string dynamic?

Atilla Rüstəmli 60 Reputation points
2024-05-20T19:12:10.4966667+00:00

Hi, I'm currently working on a project which need data from other databases. The database where I'll get the datas are depends on users. Now I want to make my connectionString dynamic. Is it correct to make connection strnig dynamic. The user will enter the connection string registration and I'll save it in my local database. And then I will get datas from there with adonet. Is it right way of coding or there is other ways to do this better?

Developer technologies | .NET | Entity Framework Core
SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,926 Reputation points Volunteer Moderator
    2024-05-20T20:06:21.26+00:00

    the only real issue is security. if the connect string require user and password, then you need to securely store the string. if the connection is integrated, then if the app is a desktop app, no issue, but if website, then the connection will be made with the pool account. a user could enter another users connection string to access their data.


  2. SurferOnWww 4,711 Reputation points
    2024-05-21T00:39:09.69+00:00

    The user will enter the connection string registration and I'll save it in my local database. And then I will get datas from there with adonet. Is it right way of coding or there is other ways to do this better?

    I do not think it (i.e., "The user will enter the connection string") is good idea due to security reasons. Why don't you create the user-dependent connection string at the server side?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.