UPDATE 2008-12-06: After Dominick Baier's comment (thanks!), I have now updated the code to be more effecient. Since .NET 2.0 it has been possible to get the groups that a user belongs to, by accessing the Groups property of the WindowsIdentity class.
Read More...