Where to put use activity logging function

304 views Asked by At

I have a function for our intranet application which will log user navigation and activity. I want to track users and need to run this function on every single page. We cant use any Google Analytics or other tools as this is intranet app and people wont have access online.

What would be the best way to perform this?

Should be create BasePage or put the code into the Masterpages? Other options?

Basically we need to check if user has session and then track his activity, both functions should be run on every single page.

edit

I forgot to mention that we need to view logs and activity online using our system. We will track user, their actions, activity and possible problems.

2

There are 2 answers

0
Nate On BEST ANSWER

Both options you mention should work, if you're doing new dev, I might go for the inherited page route -- if you're tacking this on to an existing system, I might just drop it in the master page and be done with it.

0
Conrad Frix On

BasePage and MasterPages are both a good ideas but you might also consider using HTTP modules or HTTP Handlers. This way you don't always have to remember to include the BasePage or MasterPage as part of every request

Whatever you do decide to do you should consider making sure that the logging is done out of process, since you probably want your logging to interfere as little as possible with the normal processing of your application.

There are two ways I've done this in the past.

1) Use the Enterprise Library Logging block and set up the out of process logging. This is a pain to configure and set up but has lots of options out of the box.

2) Write to a common in memory structure and use a timer to periodically process the data. When doing this I was careful to only block while getting the structure and not block while processing the structure.