|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting cs-username from an ASP.NET siteI'm currently in the process of rewriting a site that uses Classic ASP to
ASP.NET 2.0. The old site uses an ISAPI filter to put a custom application-defined value in the cs-username field of the IIS log file. This is then used by a traffic-tracking application to track a user's path through the site. Is there any way to populate this field from ASP.NET? I know I could still use an ISAPI filter, but I'd like to use a managed solution if possible. I have the application-defined value in the ASP.NET code - I guess I could put it in a cookie and have IIS log cookies, but that will take some changes to the traffic application to parse the value out of the cookie instead of just getting it from the cs-username field. Thanks for any help, Sean Carpenter Hello Sean,
As for request URL intercepting and logging, I still recommend you remain the ISAPI filter approach. This is because though ASP.NET also provide managed request processing pipeline which allow us to intercept and preprocess requests(through httpmodules), it can not intercept all the request paths, those request path without a definite document extension( such as Htttp://servername/appname/subdir/ ) can not be intercepted by ASP.NET module, thus ISAPI will be more appropriate for your scenario. AS for setting cs-username field of IIS log, I'm wondering how are you doing it in your ISAPI filter, are you using any built-in components or any 3rd party log parsing and writing component? Based on my research, IIS has provided a built-in loggin utility for accessing IIS log file(mentioned in the below blog article): http://blogs.msdn.com/robert_mcmurray/archive/2006/03/27/562127.aspx since this component is a COM object, we can directly add reference to it and use it in .net managed code through COM interop. Also, if your currently used IIS log processing component is also based on COM, it can also be used in managed code through COM interop. So far, there is not built-in .net component which can directly manipulate IIS log , and IIS log is highly restricted resources and generally ASP.NET worker process identity won't have permission to access it. Please feel free to post here if there is anything I missed or any other information you wonder. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. Steven -
Thanks for the advice. It seems like the ISAPI route will still be the correct one. The current filter uses the SF_NOTIFY_LOG flag to respond to the OnLog event in the ISAPI filter. Then it uses the HTTP_FILTER_LOG object in that event to insert the appropriate user name value in the log file. Thanks, Sean Carpenter Show quote "Steven Cheng[MSFT]" <stch***@online.microsoft.com> wrote in message news:Yc4faY4tGHA.3960@TK2MSFTNGXA01.phx.gbl... > Hello Sean, > > As for request URL intercepting and logging, I still recommend you remain > the ISAPI filter approach. This is because though ASP.NET also provide > managed request processing pipeline which allow us to intercept and > preprocess requests(through httpmodules), it can not intercept all the > request paths, those request path without a definite document extension( > such as Htttp://servername/appname/subdir/ ) can not be intercepted by > ASP.NET module, thus ISAPI will be more appropriate for your scenario. > > AS for setting cs-username field of IIS log, I'm wondering how are you > doing it in your ISAPI filter, are you using any built-in components or > any > 3rd party log parsing and writing component? Based on my research, IIS > has provided a built-in loggin utility for accessing IIS log > file(mentioned > in the below blog article): > > http://blogs.msdn.com/robert_mcmurray/archive/2006/03/27/562127.aspx > > since this component is a COM object, we can directly add reference to it > and use it in .net managed code through COM interop. Also, if your > currently used IIS log processing component is also based on COM, it can > also be used in managed code through COM interop. So far, there is not > built-in .net component which can directly manipulate IIS log , and IIS > log > is highly restricted resources and generally ASP.NET worker process > identity won't have permission to access it. > > Please feel free to post here if there is anything I missed or any other > information you wonder. > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > This posting is provided "AS IS" with no warranties, and confers no > rights. > > > > Thanks for your followup.
Yes, remain the ISAPI route will be reasonable so far. Also, if you would like to read the IIS log file ,the IIS log utility component may helps http://blogs.msdn.com/robert_mcmurray/archive/2006/03/27/562127.aspx If you meet any furhter ASP.NET specific issue, please feel free to let me know. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. the iis log can only be updated by a isapi filter. te next release of iis
(7.0) will support writing managed filters. -- bruce (sqlwork.com) Show quote "Sean Carpenter" <stcarpenter2006@community.nospam> wrote in message news:%23IHN8SytGHA.4472@TK2MSFTNGP02.phx.gbl... > I'm currently in the process of rewriting a site that uses Classic ASP to > ASP.NET 2.0. The old site uses an ISAPI filter to put a custom > application-defined value in the cs-username field of the IIS log file. > This is then used by a traffic-tracking application to track a user's path > through the site. > > Is there any way to populate this field from ASP.NET? I know I could > still use an ISAPI filter, but I'd like to use a managed solution if > possible. I have the application-defined value in the ASP.NET code - I > guess I could put it in a cookie and have IIS log cookies, but that will > take some changes to the traffic application to parse the value out of the > cookie instead of just getting it from the cs-username field. > > Thanks for any help, > Sean Carpenter > If I write an isapi filter to update the cs-username log field, is it
possible to get the user's username from the .net Membership API? Show quote >the iis log can only be updated by a isapi filter. te next release of iis >(7.0) will support writing managed filters. > >-- bruce (sqlwork.com) > > |
|||||||||||||||||||||||