Connection

  • Thread starter Thread starter Claudio
  • Start date Start date
C

Claudio

I mm developping a winforms application. I use a form do include, alter and
delete data. I created a connection using the wizard. I would like that each
user uses their own password to log in the SQL Server. I noticed the the
connection string is in a file named APPNAME.EXE.CONFIG, and the
XXXDataSet.Designer.cs file reads this connectionstring to log into the SQL.
I would like to know if there is a way to change this connection string, at
runtime, except changing the APPNAME.EXE.CONFIG file. Modifing the
APPNAME.EXE.CONFIG works fine. The problem is that the password of the last
user remain in the file.
 
Claudio,
While it's entirely possible to use (and alter) the wizard-generated
configuration files, it's neither necessary nor always a good idea to do so.
I for one don't use individual logins--I use application authentication to
gain access to the server and do private authentication once connected. This
means the application logs on with a hidden account/password that the user
never sees. Once connected, I query the user for credentials and grant
focused access to the user based on the rights defined by my application
schema. This avoids a whole series of issues including SQL injection,
complex user rights management overhead and having to change the
connectionstring on the fly--as you have discovered.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top