RE: Impersonation and SQL Connections

From: Shorty (Shorty_at_discussions.microsoft.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 11:23:06 -0700

Here is an excellent example of impersonation at MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSecurityPrincipalWindowsIdentityClassImpersonateTopic.asp

Shorty

"Clint" wrote:

> Hello all -
>
> I'm having a problem concerning Impersonation while connecting to SQL
> Server. I'm not sure if I'm posting this to the right newsgroups, so let me
> know if it belongs elsewhere, and please excuse the cross-post.
>
> I'm writing a Windows Forms application that makes direct calls to a SQL 2k
> database. This application requires a user to log in, and confirms their
> login and password with whatever they have in Active Directory. I had planned
> for the program to use the credentials of the user logged into the
> application (NOT Windows) when connecting to the SQL Server, but it seems
> I've encountered a slight pitfall.
>
> I've been reading that in this scenario, using simple Identity
> Impersonation, the SQL Server will attempt to connect as "NT
> AUTHORITY\ANONYMOUS LOGON" because of a limit to the impersonation context.
>
> I'm having trouble believing that this is true. I can impersonate users in
> ASP.NET just fine, and connect to databases using those credentials, but am
> unable to do the same through a desktop application? It doesn't make all that
> much sense, but then again, I'm somewhat of an amateur in this regard.
>
> So, that said, can anyone provide any examples or help to get this working?
> I'm happy to provide code samples, I just wasn't sure if it'd be necessary.
>
> Thanks!
> Clint



Relevant Pages

  • Impersonation and SQL Connections
    ... I'm having a problem concerning Impersonation while connecting to SQL ... application when connecting to the SQL Server, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Impersonation and SQL Connections
    ... I'm having a problem concerning Impersonation while connecting to SQL ... application when connecting to the SQL Server, ...
    (microsoft.public.dotnet.security)
  • Re: DCOM Error - Event 10009
    ... using SQL Server Management Studio 2005. ... Whenever we first launch SQL ... when connecting to a different registered server, it will hang again for 5 - ... I have checked DCOM Config using dcomcnfg, ...
    (microsoft.public.sqlserver.clients)
  • Re: Active Directory and SQL Server Connection
    ... If we use impersonation, don't I have to add every user/group to the SQL ... that would have access to the database in SQL Server, ... >> Hi Sahil, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Heres a weird one for all of you...
    ... SQL: SQL 2005 Demo ... SQL 2005 Processor Licensed (connecting via port 14330) ... Additional Major S/W on that server: ... logs showed was an operation timeout error, ...
    (microsoft.public.sqlserver.connect)