try
{
value = System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName;
}
catch (Exception e)
{
//handle exception
}
I am trying to call a method from System.DirectoryServices.AccountManagement.ni.dll to locate the UPN for the user to authenticate the client. However, in the case where the user's password has been changed by an administrator, this dll is throwing an exception and I can't figure out why catch(Exception e) is not handling it. The exception is bubbling up and taking down my application.
Is there something else I need to do to catch this exception?