Web Connection 5.0
Re: Track users activities
That *is* a subclass of wwServer that's application specific and that's absolutely the right place to do it...
+++ Rick ---
Dear Rick,
is it possible to subclass wwServer class?
I tried the following to modify LogRequest function. I think it would be not correct to modify the original wwServer class, so I added a new class with only LogRequest function, then I added
SET PROCEDURE TO myServer.prg ADDITIVE
in MyappMain.OnLoad however it does not work.
Thank you very much again
#INCLUDE WCONNECT.H ********************************************************************* DEFINE CLASS MyServer AS wwServer ********************************* *: Author: Rick Strahl *: (c) West Wind Technologies, 1995-2005 *:Contact: http://www.west-wind.com ********************************************************************* ********************************************************************* FUNCTION LogRequest ********************************************************************* ... ENDFUNC
The server object doesn't have access to the Session. In fact, the Session object most likely is no longer active when you're trying to log the value because it occurs after the process class is done processing.
So, if you want to do this you have to track this value yourself. You can:
- In your process class OnProcessInit() after InitSession() Server.oResources.AddIcActiveSession = Session.cSessionIdFUNCTION OnProcessInit() THIS.InitSession("MyApplication") Server.oResources.Add("ActiveSessionId") = Session.cSessionId ENDFUNCT
- Then modify your logging routine to log the ActiveSessionId property from the Log methodlcSessionId = THIS.oResources.Item("ActiveSessionId") IF ISNULL(lcSessionId) lcSessionId = "" ENDIF
+++ Rick ---
Dear friends,
I would like to track users activities with data from wwSession.dbf and wwRequestLog.dbf. I tried to add a new SessionId field into wwRequestLog.dbf but I do not understand how to get SessionId value in wwServer.LogRequest function:
INSERT INTO (THIS.cLogFile) ; (TIME, QueryStr ,REMOTEADDR, Duration,Error,Script,MemUsed,ReqId,SessionId) ; VALUES (DATETIME(), ; lcParameter ,; lcRemoteAddress,; lnSeconds,llError,; lcExecutable,; SYS(1016),; lcReqId,; SessionId)
If I create a wwSession object just before INSERT I see the oSession.cSessionId property empty.
How to see wwSession object from wwServer?
I would like to use this solution rather add a new function writing SessionID and users data at every hit, because I am afraid to slow the web application.
Thank you very much
Rick Strahl
West Wind Technologies
Making waves on the Web
West Wind Technologies
Making waves on the Web
from Maui, Hawaii