This topic is locked

Identify Logged In User in SQL Server 2008

5/17/2010 9:03:58 AM
ASPRunnerPro General questions
M
mgallo author

I'm using SQL Server 2008 & ASPRunner v6.1 with Windows Authentication for a simple database.
I created an audit table in the database and want to log who made the change. I've tried both SUSER_SNAME and ORIGINAL_LOGIN but both capture my username and not the user that's logged into through ASPRunner.
I couldn't find any previous posts that addressed this. TIA.

A
ann 5/17/2010

Hi,
to capture username try

Session("UserID")

.

M
mgallo author 5/17/2010

Sorry if I misunderstood your reply but my issue is the server identifying who is logged in. Your reply looks like a client side command.

A
ann 5/18/2010

Hi,
Session() is a server side command.

Sergey Kornilov admin 5/18/2010

Session("UserID") stores username of current user (if you use login page in ASPRunnerPro application).
Request.ServerVariables("LOGON_USER") stores Windows login name.

C
clig 5/19/2010



I'm using SQL Server 2008 & ASPRunner v6.1 with Windows Authentication for a simple database.
I created an audit table in the database and want to log who made the change. I've tried both SUSER_SNAME and ORIGINAL_LOGIN but both capture my username and not the user that's logged into through ASPRunner.
I couldn't find any previous posts that addressed this. TIA.


The other issue is that you would have to use NT Integrated Security to pass the client's credentials to MSSQL however thi would require that you manage these users in MSSQL / AD - if this is a "register my name in a table" then you would need to follow the above and capture the login from ASP via session var and store that...

M
mgallo author 5/19/2010

Again, sorry for my confusion (I'm not an ASP programmer)...
In SQL Server 2008 I'm using CDC to generate an audit table and automatically insert a row for every change to a data table. I've added a column to the audit table to capture the user that is currently logged in and making the change. I tried both SUSER_SNAME and ORIGINAL_LOGIN as the default but keep getting me (the creator of the ASPRunner application) not the person using the application.
I though that using Windows Authentication in ASPRunner would pass the user's login into the database, but this seems not to be the case. BTW I don't want to change the login process for the users, which is working just fine as it is.
TIA!

C
clig 5/20/2010



Again, sorry for my confusion (I'm not an ASP programmer)...
In SQL Server 2008 I'm using CDC to generate an audit table and automatically insert a row for every change to a data table. I've added a column to the audit table to capture the user that is currently logged in and making the change. I tried both SUSER_SNAME and ORIGINAL_LOGIN as the default but keep getting me (the creator of the ASPRunner application) not the person using the application.
I though that using Windows Authentication in ASPRunner would pass the user's login into the database, but this seems not to be the case. BTW I don't want to change the login process for the users, which is working just fine as it is.
TIA!


It's the connection string that needs to use SSPI then you must manage those users in MSSQL to get the client as SUSER_SNAME - what does your connection string say in ASPRunner?

M
mgallo author 5/20/2010

My conection string contains "Trusted_Connection=Yes", which is the string created by ASPRunner.
I'm not sure what the difference is with "Integrated Security=SSPI" and Google and MSDN were little help.
Other pieces of the puzzle:
I'm also not sure what you meant by "manage those users in MSSQL".
Thanks for the help because I'm stumped.