AccountManagement.UserPrincipal.Current takes 5 seconds
Posted
by Adel Hazzah
on Stack Overflow
See other posts from Stack Overflow
or by Adel Hazzah
Published on 2010-04-09T20:02:10Z
Indexed on
2010/04/09
20:03 UTC
Read the original article
Hit count: 739
.NET
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?
© Stack Overflow or respective owner