SQL server authentication using impersonation

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.WindowsImpersonationContext

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
.



Relevant Pages

  • Re: Sql Server 2005 Dev. Ed. on Windows Server 2003
    ... Check out this KB which is about transferring Logins: http://support.microsoft.com/kb/246133 ... Also, since this is running on a newly installed Windows Server 2003, is ... them from your older SQL Server instance to the newer one. ...
    (microsoft.public.sqlserver.setup)
  • Re: SQLServer Connection Problems...
    ... making it all the way to SQL but its failing at the SQL login. ... Only take this step if your server is protected inside a good firewall... ... Most good judgment comes from experience. ... I can ping the SBS server from the Web Server on a local ip address ...
    (microsoft.public.sqlserver.connect)
  • Re: New Windows Infrastructure
    ... vendor's application runs on windows with an SQL database and I will also need a web server for a separate module which will allow our customers to access account data online. ... I would think that if the app runs on windows, I do not need the citrix server. ... It makes sense to have separate DCs though, because let's say you want to upgrade your Active Directory in two weeks time, with separate DCs it's easy, but if you've got a bunch of apps installed it could be a nightmare. ...
    (microsoft.public.win2000.setup_deployment)
  • How can I avoid using SQL Authentication with the Office Web Parts?
    ... We have a machine running Windows 2003 Server, IIS 6, and Windows SharePoint ... We are using Office Web Parts on several Web ... Part pages to display data retrieved from a SQL Server (SQL 2000 SP3 running ...
    (microsoft.public.sharepoint.portalserver.development)
  • How can I avoid using SQL Authentication with the Office Web Parts?
    ... We have a machine running Windows 2003 Server, IIS 6, and Windows SharePoint ... We are using Office Web Parts on several Web ... Part pages to display data retrieved from a SQL Server (SQL 2000 SP3 running ...
    (microsoft.public.office.developer.web.components)