HighTechTalks DotNet Forums  

SQL server authentication using impersonation

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss SQL server authentication using impersonation in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
misterhodes@googlemail.com
 
Posts: n/a

Default SQL server authentication using impersonation - 05-11-2009 , 04:02 AM






Hi,
I have a web server on a SBS 2003 box, and SQL server running on
seperate Windows Server 2003 box.
I want to impersonate the current user when executing SQL procedures.
The database filters rows depending on who the windows user is, so
it's important I forward the identity of the original user, and don't
use a generic one.

If i test the web application from my Visual Studio window (on a third
machine), then the authentication works fine, presumably because I'm
logged on as a user who has database admin permissions.
If I log on from another machine, the identity doesn't get forwarded.
The config file inludes:

<authentication mode="Windows"/>
<identity impersonate="true" />

The vb code includes:
Dim WinId As System.Security.Principal.IIdentity
Dim Wi As System.Security.Principal.WindowsIdentity
Dim Wic As
System.Security.Principal.WindowsImpersonationCont ext

WinId = HttpContext.Current.User.Identity
Wi = WinId
Wic = Wi.Impersonate()

But when I try opening the SQL connection
(Data.SqlClient.SqlConnection) then I get the error:
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Any ideas please?

Thank you in advance

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.