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.
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.
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.
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.
So, we're now on SQL Server 2008 and I'm re-evaluating. The lead dev is no longer here.
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.
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.