Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top