Coding, content and startups

James Crowley

Archive for June, 2007

Gotcha: HTTP_X_FORWARDED_FOR returns multiple IP addresses

with 14 comments

I hit a small gotcha this evening. A visitor to Developer Fusion reported that they couldn’t gain access to the site at all, because our IP address detection logic was failing. We were checking the “HTTP_X_FORWARDED_FOR” header for an IP address, before falling back to REMOTE_ADDR, turning the IP into a long integer, and doing an IP-to-country lookup in our database. Which seemed safe enough!


As it turns out, HTTP_X_FORWARDED_FOR can sometimes have a comma delimited list of IP addresses – so what we actually needed to be doing was take the last IP address in that list, before doing our conversion to an integer.


Thanks go out to Francois Botha, one of our visitors, for helping me track down this issue!

Written by james.crowley

June 19th, 2007 at 9:00 pm

Posted in Uncategorized

C# <-> VB.NET Converters Updated

with 4 comments

We’ve just updated our free C# to VB.NET and VB.NET to C# converters on Developer Fusion – they’re adapted from the neat little utilities within the free .NET IDE, #develop . They now keep your comments in tact too. Great for when you’ve found those bits of sample code in the wrong language! If you haven’t come across them before, they’re well worth a look.


[Update: They support generics now too!]

Written by james.crowley

June 9th, 2007 at 2:28 pm

Posted in Uncategorized