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.