G
Guest
Hi,
I am using a win32 function, LogonUser, to impersonate a user across a WCF
service. I have noticed that everytime I call this function, a new logon
session is created for that user, meaning that multiple calls yields multiple
sessions. I cache a WindowsIdentity object that represents the user so that I
can call the Impersonate method whenever I need to without creating a new
session, but I really need to be able to log the user off when they close the
client application to avoid leaving open logon sessions. I've tried calling
ExitWindowsEx with a LogOff flag while impersonating as the relevant user,
but although the call seems to be successful (according to
Marshal.GetLastWin32Error()) it leaves the user logged in. However, closing
my WCF service DOES log the user off.
Can anyone tell me how I can log a specific user off? Also, is it the case
that a user is logged off if the process that created the logon is closed?
Cheers,
Chris
I am using a win32 function, LogonUser, to impersonate a user across a WCF
service. I have noticed that everytime I call this function, a new logon
session is created for that user, meaning that multiple calls yields multiple
sessions. I cache a WindowsIdentity object that represents the user so that I
can call the Impersonate method whenever I need to without creating a new
session, but I really need to be able to log the user off when they close the
client application to avoid leaving open logon sessions. I've tried calling
ExitWindowsEx with a LogOff flag while impersonating as the relevant user,
but although the call seems to be successful (according to
Marshal.GetLastWin32Error()) it leaves the user logged in. However, closing
my WCF service DOES log the user off.
Can anyone tell me how I can log a specific user off? Also, is it the case
that a user is logged off if the process that created the logon is closed?
Cheers,
Chris