Re: HTTP Module some help ?
ASP.NET
Thread Starter: Paschal
Started: 12-07-2004 10:20
Replies: 6

Ireland .NET Developer Alliance :: Forums » Technologies » ASP.NET » Re: HTTP Module some help ?
« Previous Thread Next Thread »
   07 Dec 2004, 10:20
Paschal is not online. Last active: 21/01/2005 07:51:28 Paschal
HTTP Module some help ?
I need to track the links users clicks all over a web application.

I know I can fo it through Global.asax but I would prefer a more general approach.

I read about HTTP modules, but I reckon I am not an expert on the subject.

Somebody to help [:$] ?
  
   08 Dec 2004, 12:05
Brian Delahunty is not online. Last active: 12/01/2005 12:36:21 Brian Delahunty

Top 10 Posts
Joined on 11 Nov 2004
Posts 7
Re: HTTP Module some help ?
Drop me an email with the details of the HTTP Module that you require and I can through the module together.
 
    
   08 Dec 2004, 4:58
Paschal is not online. Last active: 21/01/2005 07:51:28 Paschal
Re: HTTP Module some help ?
Thanks Brian, I got one httpmodule by Jamie and it works fine. The thing now is that I am trying to find an easy way to track the user click on external link.

Any ideas ?
  
   09 Dec 2004, 10:01
Marcus is not online. Last active: 19/01/2005 23:06:58 Marcus



Top 10 Posts
Joined on 31 Oct 2004
Dublin, Ireland
Posts 19
Re: HTTP Module some help ?
The only way to track outbound click thru's is to replace all external links with proxy links...

The problem is that once an external link is sent to the client, you loose control over any navigation to that link.

There is a relatively easy way to do this on a global basis which involves filtering all HTML before it is sent to the client.

Here are some "top of the head" points to think about for the implemenation:
  1. Create a SQL table called "ExternalLinks" or whatever...
  2. Create a stored procedure which returns a GUID for each unique link. Internally this SP searches the links table for the required link and returns it's GUID. If not found, it inserts a new row and returns the new GUID. Optimisations will be necessary here and you could add a link Hashcode to improve lookup speed.
  3. Create a second stored porcedure which returns a link for a given GUID.
  4. In the ASP.NET app, create a page called "ExternalLink.aspx" which takes a GUID as a QueryString parameter. In this page, call the link lookup SP with with the GUID param and perform a Redirect on the client. This is also where you log the click thru.
  5. In a HTTPModule, create a RegEx which matches all hyperlinks and run the regex against the outbound HTML
  6. For each match call the SP to get the link GUID
  7. Replace matches with "" etc
Of course since the Links are static, making extensive use of the ASP.NET Cache will greatly improve performance and save you having to call multiple SP per page view...

I'm sure there are going to be a bunch of other optimisations necessary before this will perform in production, but hopefully this is a start...

Marcus


blog: http://www.styledesign.biz/weblogs/macinnesm/
 
    
   09 Dec 2004, 10:32
Paschal is not online. Last active: 21/01/2005 07:51:28 Paschal
Re: HTTP Module some help ?
Nice Marcus but the httpmodule will  not work with external links. Unless as Jamie suggested that you redirect the user to the ExternalLink page with the GUID.

In this case it mean that you don't see anymore the original link on the page.

Instead of you will see something like which is valid but not very elegant.

I wonder now anyway if with URL rewriting I could mask the GUID.
  
   09 Dec 2004, 10:47
Marcus is not online. Last active: 19/01/2005 23:06:58 Marcus



Top 10 Posts
Joined on 31 Oct 2004
Dublin, Ireland
Posts 19
Re: HTTP Module some help ?
> " Nice Marcus but the httpmodule will  not work with external links."

That's why you have to replace the external links with proxy links before they are sent to the client, but as you say this is not very elegant...

I'm not sure what Jamie said, is that conversation on another thread?

URLRewriting could easily be implemented on top of the suggestions above which would replace the querystring parameter with a virtual URL like , but Im not sure this gives you anything extra and may just end up sucking more resources out of the server...

The other issue with implementing this site wide is that search engines like Google etc, rank sites (amongst other things) based on the number of links to external sites... Using proxy links is essentially going to remove all external links and reduce your overall site and page rankings.

Marcus



blog: http://www.styledesign.biz/weblogs/macinnesm/
 
    
   09 Dec 2004, 10:49
Paschal is not online. Last active: 21/01/2005 07:51:28 Paschal
Re: HTTP Module some help ?
Thanks Marcus. But it's not for an implementation on Developers.ie, but for another project at work :-)
  
  Page 1 of 1 (7 items)
Ireland .NET Developer Alliance :: Forums » Technologies » ASP.NET » Re: HTTP Module some help ?

Powered by Community Server :: Forums