Monthly Archives: November 2006

My .NET Development Toolbox Update 2

New additons to my “My .NET Development Toolbox” and “My .NET Development Toolbox Update” lists:

Google Analytics Module

Some months ago Daniel Cazzulino publishes an excellent IHttpModule to use Google Analitycs with adding code in the pages of a web site.
After using it some weeks I found an error that affects the Clearscreen CAPTCHA Antispam Control.
Basically the problem is that the module adds the HTML code necessary to use Google Analytics in responses that are not HTML (like an image).

This is quick fix to this bug:

void OnBeginRequest(object sender, EventArgs e)
   if ( String.Compare(“text/html”, application.Response.ContentType, true) == 0
&& ! ( application.Request.QueryString.Count != 0
&& application.Request.QueryString.GetKey(0) == “hip” ) )
application.Response.Filter = new AnalyticsStream(application.Response.Filter, accountNumber);

Here you can download a test solution to reproduce this bug.

%d bloggers like this: