Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RE: Best way to monitor online user activity?

Reply
Thread Tools

RE: Best way to monitor online user activity?

 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-08-2006
Hello Matt,

Do you mean you want to create a profile component that will log all the
requests from each client users(to certain pages in the application)?

Based on my experience, since you want to capture both the user identiy
info and the page they're requesting, and also need to separate this
profile logic from normal page code logic, I think using a custom
HttpModule should be a good approach.

Each page request arrive at IIS and ASP.NET runtime will be processed by an
HttpApplication pipeline, and at the begining of the pipeline, there are
series of httpModules that will do some preprocessing before the final
handler that process the request. e.g. you can find those predefined
built-in httpmodules in the global web.config(or machine.config for .net
1.1):

#each module is used for a certain service(such as SessionState,
OutputCache, FormsAuth....)
=============================
<httpModules>
<add name="OutputCache"
type="System.Web.Caching.OutputCacheModule" />
<add name="Session"
type="System.Web.SessionState.SessionStateModule" />
<add name="WindowsAuthentication"
type="System.Web.Security.WindowsAuthenticationMod ule" />
<add name="FormsAuthentication"
type="System.Web.Security.FormsAuthenticationModul e" />
<add name="PassportAuthentication"
type="System.Web.Security.PassportAuthenticationMo dule" />
<add name="RoleManager"
type="System.Web.Security.RoleManagerModule" />
<add name="UrlAuthorization"
type="System.Web.Security.UrlAuthorizationModule" />
<add name="FileAuthorization"
type="System.Web.Security.FileAuthorizationModule" />
<add name="AnonymousIdentification"
type="System.Web.Security.AnonymousIdentificationM odule" />
<add name="Profile" type="System.Web.Profile.ProfileModule" />
<add name="ErrorHandlerModule"
type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>
===============================


For your scenario, you want to get the client user identity info and
session info, you can create a custom httpmodule and configure it behind
those built-in module. And in custom httpmodule code, you can hook the
certain global event you want(see below msdn reference) and add the tracing
and logging code there(you can easily get the requested path, or other
client user info there also)


#How To Create an ASP.NET HTTP Module Using Visual C# .NET
http://support.microsoft.com/kb/307996/en-us

#How to: Create Custom HTTP Modules
http://msdn2.microsoft.com/en-us/library/ms227673.aspx


Here is also a msdn reference introducing the ASP.ENT application's
application life cycle:


#ASP.NET Application Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178473.aspx


Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-11-2006
Hi Matt,

Thanks for your reply.

As for httpmodule, there are many events we can hook in it. And as
described in the following kb article:

http://support.microsoft.com/kb/307996/en-us

* AuthenticateRequest: Call this event when a security module needs to
authenticate the user before it processes the request.
* AuthorizeRequest: Call this event by a security module when the request
needs to be authorized. Called after authentication.

these two events a good place for get the authenticated user identity info
in httpmodule. Also, make sure you need to put your custom module after
other authentication specific modules(like the FormsAuthenticationModule
....).

As for the storage, I think database should be preferred if you want the
logged data to be persistent and read anytime from other pages. Also, for
short term log data(such as the ASP.NET trace), we can also store it in
memory and set a sliding window. That means, the in-memory log and only
hold a limited number of log records and after exceed the limit, the new
log will override the olde one.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-12-2006
That's fine.

good luck!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
online games, free online games, games to play online princess Computer Support 0 05-13-2007 10:58 AM
online games, free online games, games to play online princess Computer Support 0 05-10-2007 09:25 AM
online games, free online games, games to play online princess Computer Support 0 05-10-2007 09:23 AM
Best way to monitor a logged in user Astra ASP General 0 05-19-2004 02:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57