2013-12-19 2 views
0

Windows 암호가 잘못 작성된 경우 마지막으로 시도하고 있습니다.FindByBadPasswordAttempt를 호출 할 때 예외가 발생했습니다.

PrincipalContext pc = new PrincipalContext(ContextType.Machine); 
var v = UserPrincipal.FindByBadPasswordAttempt(pc, DateTime.Now, MatchType.LessThan); 

하지만 코드의 두 번째 줄에 NotSupported를 예외가 : 그리고 그것을 할 나는 UserPrincipalSearcher 사용합니다. 문제가 무엇입니까?

+0

전체 스택 추적을 표시 할 수 있습니까? –

답변

0

이 메서드는 날짜를 UTC 형식으로 나타냅니다. 도움말 파일에 언급되어 있지는 않지만 잘못된 날짜 형식이이 예외의 원인이 될 수 있다고 생각합니다.

DateTime.Now 대신 DateTime.UtcNow을 전달합니다.

+0

예외는 NotSupported 예외입니다. – user3117932

+0

'UserPrincipal.Current.LastBadPasswordAttempt'를 시도하면 어떻게 될까요? – nvoigt