protected void OnSessionLogon(int sessionId) { Account account = new Account(GetSessionUser(sessionId)); EventLog.WriteEntry( string.Format("User {0}\\{1} logged on", account.Domain, account.UserName), EventLogEntryType.Information, 528 ); LogonEventProxy proxy = new LogonEventProxy(account); LogonEventAdapter adapter = new LogonEventAdapter(credentials); proxy.Add(adapter); }
/// <summary> /// Records an login event. /// </summary> void Login() { Account account = new Account(); try { EventLog.WriteEntry( ProgramInfo.Product, string.Format("User {0}\\{1} logged on", account.Domain, account.UserName), EventLogEntryType.Information, 528 ); } catch (System.Security.SecurityException exception) { Report(exception); } LogonEventProxy proxy = new LogonEventProxy(account); LogonEventAdapter adapter = new LogonEventAdapter(this.options.Credentials); proxy.Add(adapter); }