Connect SQL Server from Windows Forms - Windows Authentication Mod

  • Thread starter Thread starter Lubos Hladik
  • Start date Start date
L

Lubos Hladik

Hi,

is there a way how to connect to SQL Server from Windows Forms, when Windows
Authentication Mode is set and client (application) runs on a computer not in
a domain?

Can I use some impersonation? I tried to use LogonUser() from advapi32.dll,
but it doesn't work, when computer is not in a domain :(

Thanks
 
Set SQL Server to use mixed mode security. Setup a login account and
password. Make sure the selected port and protocol is enabled on the server
and not blocked by firewalls. Make sure the server's name is visible via the
DNS.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________
 
I would strongly discourage connecting to a remote database directly
from a WinForms application if this application will be deployed to
multiple desktops because this requires putting the connection string
on every client machine that connects to the database. While there /
are/ some things you can do to make it more difficult for malicious
users to see the connection string, you can't stop a determined and
knowledgeable user from getting it.

Instead, I highly recommend exposing all data access via a web
service. Your WinForms application can then call the web service
methods. There are multiple techniques for securing web services too
and many can be implemented on top of each other. Inside the web
service, you can also write more complex security in addition to
everything else you can do with them.

HTH
http://csharpner.blogspot.com
 
Back
Top