2
我是mvc3和i的初学者,我创建了一个Internet应用程序,为此我需要应用Windows身份验证并检查AD中的用户角色。这可能与LDAP?我在网上搜索,但似乎没有清楚。因此,要求你们协助或发布一些链接,对于要遵循的程序有明确的解释。在mvc3中通过LDAP进行Windows身份验证
在此先感谢!
我是mvc3和i的初学者,我创建了一个Internet应用程序,为此我需要应用Windows身份验证并检查AD中的用户角色。这可能与LDAP?我在网上搜索,但似乎没有清楚。因此,要求你们协助或发布一些链接,对于要遵循的程序有明确的解释。在mvc3中通过LDAP进行Windows身份验证
在此先感谢!
这是可能的,
看一看这个URL
是的,它是可能的。网上有很多样本。
在你的web.config添加LDAP连接字符串:
<connectionStrings>
<add name="ADConnectionString" connectionString="LDAP://what ever it is" />
</connectionStrings>
还增加以下内容:
<authentication mode="Forms">
<forms name=".ADAuthCookie" loginUrl="~/Account/LogOn" timeout="15" slidingExpiration="false" protection="All" />
</authentication>
<membership defaultProvider="ADMembershipProvider">
<providers>
<clear />
<add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" />
</providers>
</membership>
其余的应该工作一样正常SQL成员:
public ActionResult LogOn()
{
return View();
}
[HttpPost]
public ActionResult LogOn(LogOnViewModel viewModel, string returnUrl)
{
if (ModelState.IsValid)
{
if (Membership.ValidateUser(viewModel.UserName, viewModel.Password))
{
}
}
}
Your LogOnViewModel:
public class LogOnViewModel
{
public string UserName { get; set; }
public string Password { get; set; }
}
我希望这可以帮助你在正确的方向。
可能是一个问题http://serverfault.com – mishik