Я реализовал реализованную аутентификацию Active Directory в ASP.NET MVC 5 с использованием LDAP. Я хочу знать, как получить пользователь < /p>
Заблокированная учетная запись (Boolean) < /li>
Срок действия пароля истекает (Boolean) < /li>
Дата истечения пароля (DateTime) < /li>
< /ol>
p> p> p> p> p> p> p> p> p> p> p> pretime) />
using System.Web.Mvc;
using System.Web.Security;
using MvcApplication.Models;
[HttpPost]
public ActionResult Login(LoginModel model, string returnUrl)
{
if (!this.ModelState.IsValid)
{
return this.View(model);
}
if (Membership.ValidateUser(model.UserName, model.Password))
{
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
if (this.Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
&& !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
{
return this.Redirect(returnUrl);
}
return this.RedirectToAction("Index", "Home");
}
this.ModelState.AddModelError(string.Empty, "The user name or password provided is incorrect.");
return this.View(model);
}
public ActionResult LogOff()
{
FormsAuthentication.SignOut();
return this.RedirectToAction("Index", "Home");
}
Подробнее здесь: https://stackoverflow.com/questions/432 ... -directory