Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I log the Windows user, not service account, to database?
    primarykey
    data
    text
    <p>We have a .NET 4 web application running on our intranet. When a user starts the application, the user's Windows creds are checked to ensure the user is a member of the correct Active Directory groups. If all goes well, the user is sent to our application page and they can begin working.</p> <p>The web application connects to the database through a generic service account (an account with limited abilities for doing things as a generic user). The system works fine. The user edits are logged.</p> <p>The problem is the user name being logged. The user name that gets logged is the name of the service account, not the name of the user. As you can imagine, this makes audits quite useless. Yes, we can tell a change was made and when the change was made and even what the change was but we can't tell who made the change.</p> <p>Some background - This project was started years ago and, at the time, built on SQL Server 2005. At that time, the lead developer concluded it wasn't possible to passthrough the Windows username to the database and get it to log the user name properly. The decision was made to "live with it" and re-evaluate when we moved to SQL Server 2008.</p> <p>So, we're now on SQL Server 2008 and I'm re-evaluating. The lead dev is no longer here.</p> <p>How do I continue using my service account but log the Windows account name? We don't want to create SQL accounts for each user.</p> <p>UPDATE 1 - I left out a critical detail. All the change logs we generate are trigger based. The audit records are generated by the database via triggers whenever a change occurs, not through SQL code in the web app.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload