I am working on a new asp.net mvc5 web application that uses the new ASPNET.Identity instead of the old form authentication. For my previous asp.net mvc4 web applications, I did the following to have a form authentication which will authenticate users against
our AD ldap server. The Login action method looks as follow:-
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{
MembershipProvider domainProvider;
domainProvider = Membership.Providers["ADMembershipProvider"];
if (ModelState.IsValid)
{
// Validate the user with the membership system.
if (domainProvider.ValidateUser(model.UserName, model.Password))
{
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
...
Go to the complete details ...