March, 2009


13
Mar 09

Facebook Just Turned Into Twitter

The mad phenomenon that is Twitter has been a serious influence on the latest version of Facebook, so it seems. I think the very first thing I said when I logged onto Facebook today was “Facebook is trying to be like twitter”, low and behold many other of my friends were sporadically “status changing” with the exact same thing. Well that’s just a darn shame. I think the Internet has gone into an adverse state of pointlessness.


5
Mar 09

IHttpModule Over Global.asax

I had the job of re-writing some old code that existed in Global.asax which is used to respond to certain initialisation and tear-down events. A significant event of ours is the Session_Start event as this is where we assign session variables used for the lifetime of the transactions carried out by the user. It’s quite common practise as I have seen and is extremely handy in the context of our application.

The re-write was basically to move some code to a more secure location within a compiled stored procedure on our SQL server (later versions of SQL provide some handy features). I first researched any improvements upon Global.asax as it has been around for so long and had been superseded by its predecessor, Global.asa. IHttpModule was a major hit and seemed to be specifically designed for the purposes of improving upon Global.asax. VB.NET isn’t quite as savvy as registering event listeners in comparison to other popular languages such as C#.NET or Java so that was the first major hurdle I had to get over (which took quite some time, MSDN isn’t the best search tool ;) ). Unfortunately upon further coding I came to realise that the Session_Start event which was freely available – and worked perfectly in Global.asax – firstly didn’t even exist, and secondly required some hacks to ensure that the relative code was called at that specific point in the initialisation of the web session. The solutions I saw just weren’t worth it to be honest.

If you’re looking to ensure that certain code is called on Session_Start then I’d highly advise just sticking with Global.asax. If you don’t require Session_Start and Session_End then it’s definitely worth looking at implementing the IHttpModule interface. Registering the class in your Web.Config allows it to respond to the relative events that are setup to respond to within the implementation. It’s basically a modularised solution to Global.asax. Anyway, I thought this may be a handy bit of knowledge to save you a few hours of tedious work :)