1
我用下面的代碼進行驗證,AD服務器「域\用戶」域驗證失敗
using (var context = new PrincipalContext(ContextType.Domain))
{
return context.ValidateCredentials(samAccountName, password.RetrieveString()
, ContextOptions.Negotiate);
}
的事情是,如果我用"[email protected]"
它只會工作,如果我使用它不會工作"domain\user"
。
任何想法爲什麼?
您是否嘗試傳遞字符串作爲'「domain \\ user」'?必須正確地轉義字符串... –
嗨Merlyn,我使用@「domain \ user」,它是一樣的,對嗎? –
是的,這是妥善逃脫。 –