Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Track users activities

$
0
0
Re: Track users activities
Web Connection 5.0
Re: Track users activities
10/28/2012
01:28:42 PM
3MQ0SW0VM Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None

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.cSessionId

    FUNCTION OnProcessInit() THIS.InitSession("MyApplication") Server.oResources.Add("ActiveSessionId") = Session.cSessionId ENDFUNCT

  • Then modify your logging routine to log the ActiveSessionId property from the Log method
    lcSessionId = 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

from Maui, Hawaii


Viewing all articles
Browse latest Browse all 10393

Trending Articles