我有两个应用,一个是窗体身份验证,看起来像这样:ASP.NET混合身份验证
<authentication mode="Forms">
<forms loginUrl="~/Login"></forms>
</authentication>
public class LoginController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult LoginCheck()
{
string username = Request.Form["username"];
FormsAuthentication.RedirectFromLoginPage(username, true);
return RedirectToAction("Index", "Home");
}
}
其他应用程序是空的,但使用Windows身份验证:
<authentication mode="Windows" />
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Title = "Home Page";
return View();
}
}
我是什么试图做的是:
用户填写他们的用户名和密码的形式authen tication应用和点击提交
的LoginCheck方法,采用用户名和密码,验证对抗是Windows身份验证
我,希望我得到的Windows身份验证应用程序话说响应的应用程序是这个用户名和密码是正确的,继续或没有他们不工作
我在正确的轨道上我想完成?我的问题是我不知道如何完成第2部分,如果有人能帮助我,那将是惊人的或者指向正确的方向。
为什么需要混合它?如果Web堆栈位于您的域中,并且您有权访问AD,为什么不使用Windows身份验证?如果没有,那为什么要使用windows auth呢? –
混合它,因为我想用一个窗体而不是一个丑陋的对话框。 – user979331
我很确定Windows代码验证发生在您的代码执行之前。您最好使用Forms Authentication并使用ActiveDirectoryMembershipProvider,如[this](https://msdn.microsoft.com/en-us/library/ff650308.aspx)。 –