Let me hazard a guess: what we're seeing isn't really the actual code that's failing. I want to know more about where you get "username" from. Clearly you're not hardcoding it, since that would be a bad idea. Everything I've read on this so far indicates that it nothing to do with Sharepoint and everything to do with creating a good connection to AD.
Hope the hint helps.