I have a web page that runs under an account named, WebUser
(IIS runs under this account)
Now the problem here is that, when the webpage is accessed by users (intranet),
users are authenticated through Windows Authentication.
The webpage calls a stored procedure, SaveClientInfo
.
When I was trying to get the user's name (say, User1) who was calling SaveClientInfo
,
I was getting WebUser instead of User1 through SYSTEM_USER
Is there a way to get User1 from SaveClientInfo
without having to pass in the user name to the stored procedure?
Here is the relevant piece of sproc definition
create procedure SaveClientInfo
@ClientID int
... --; other parameters
as
begin
declare @UserName sysname
--; returns the name of user name that IIS runs under
--; But I would like to log the name of the person
--; who is accesing the site through Windows Authentication
select @UserName = SYSTEM_USER
--; Save client data and the person who saved the info
...
end
GO