PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Connect SQL Server from Windows Forms - Windows Authentication Mod

 
 
Lubos Hladik
Guest
Posts: n/a
 
      5th Nov 2009
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
 
Reply With Quote
 
 
 
 
William Vaughn \(MVP\)
Guest
Posts: n/a
 
      7th Nov 2009
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
____________________________________________________________________________________________



"Lubos Hladik" <(E-Mail Removed)> wrote in message
news:C870749E-65E8-48F5-BE34-(E-Mail Removed)...
> 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


 
Reply With Quote
 
CSharpner
Guest
Posts: n/a
 
      11th Nov 2009
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


On Nov 7, 12:06*am, "William Vaughn \(MVP\)" <bil...@Betav.com> wrote:
> 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
> ____________________________________________________________________________________________
>
> "Lubos Hladik" <LubosHla...@discussions.microsoft.com> wrote in message
>
> news:C870749E-65E8-48F5-BE34-(E-Mail Removed)...
>
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using forms or windows authentication for Login in MSSql Server(integratedsecurity) sefe dery Microsoft ASP .NET 0 7th Sep 2005 09:00 PM
Configure Database Connection Can't Connect to SQL Server using Windows Authentication Joseph Microsoft Frontpage 1 25th Feb 2005 04:59 PM
Can't connect to SQL Server, using Windows Authentication users of SQL server? help =?Utf-8?B?UmV6YQ==?= Microsoft ASP .NET 3 7th Jun 2004 07:42 PM
connect to SQL server: windows authentication / SQL Server authentication Lloyd Dupont Microsoft Dot NET Framework 2 7th May 2004 02:29 AM
Using Windows authentication the connect to SQL Server on different machine Richard West Microsoft ADO .NET 0 6th Oct 2003 10:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:07 AM.