Friday, June 19, 2009

Terminate a clien session

I was recently involved in a discussion over at the Microsoft Business Community newsgroups. The subject was the terminating of a client session.

I can suggest two approaches. Use the first job to kill the session of a specified user id. This involves the use of the xSession class, which I blogged of earlier on.

static void TerminateSession(UserId UserId)
{ xSession xSession;
int xSessionId;
xSessionId = (select * from SysClientSessions where SysClientSessions.userId==UserId && SysClientSessions.Status==1).SessionId;

xSession = new xSession(xSessionId);
if (xSession)
xSession.terminate(xSession.loginDate(), xSession.loginTime());

If you would like to end the current session by code, you can do it like this:

static void ShutDown(Args _args)
{ Info Info = new Info();

If you can think of other means, feel free to post them in the comments.

No comments:

Post a Comment