AccountManagement.UserPrincipal.Current takes 5 seconds
- by Adel Hazzah
I'm using the new .NET 3.5 System.DirectoryServices.AccountManagement API.
In my code, I need to determine the current System.DirectoryServices.AccountManagement.UserPrincipal.
My naive approach was to do this:
using AccountManagement = System.DirectoryServices.AccountManagement;
...
// Determine current UserPrincipal.
// (On my machine, this blocks for 5 seconds)
//
AccountManagement.UserPrincipal principal = AccountManagement.UserPrincipal.Current;
My computer is a stand-alone machine running Vista. I am not part of any domain, etc.
Any ideas on how to improve the performance?