使用 Windows 身份验证,没有弹出窗口
Using Windows Authentication, not getting a popup
在我的程序中,我尝试使用 Windows 身份验证,我以前从未使用过它,所以很困惑。通过将此添加到我的 Web.config
:
中,我遵循了我认为应该做的以及我在 google 搜索中发现的内容
<authentication mode="Windows" />
<authorization>
<deny users="?"/>
</authorization>
我的 IIS 设置如下所示:
但是每当我 运行 我的网站时,当我相信我应该得到一个要求我的 username/password 的弹出窗口时,它就会正确加载。我怎样才能解决这个问题?谢谢
几天前我做了一个非常相似的事情,我做的是以下内容,
在我的登录表单过程中
using System.DirectoryServices.AccountManagement;
public bool Login(string user, string password) {
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOUR DOMAIN WITH ACTIVE DIRECTORY"))
{
return pc.ValidateCredentials(user, password);
}
}
希望对您有所帮助!祝你好运!
如果您尝试使用 Firefox、Seamonkey 并且可能 Chrome,您应该会看到一个弹出窗口。如果你想用 Internet Explorer 弹出窗口,试试这个:
工具 |互联网选项 |安全 |本地 Intranet(或其他区域)|自定义级别 |用户认证 |提示输入用户名和密码
编辑:您可以在菜单栏上找到工具。如果您没有看到菜单栏,请通过右键单击选项卡附近的某处并启用菜单栏来打开它。看截图:
在我的程序中,我尝试使用 Windows 身份验证,我以前从未使用过它,所以很困惑。通过将此添加到我的 Web.config
:
<authentication mode="Windows" />
<authorization>
<deny users="?"/>
</authorization>
我的 IIS 设置如下所示:
但是每当我 运行 我的网站时,当我相信我应该得到一个要求我的 username/password 的弹出窗口时,它就会正确加载。我怎样才能解决这个问题?谢谢
几天前我做了一个非常相似的事情,我做的是以下内容, 在我的登录表单过程中
using System.DirectoryServices.AccountManagement;
public bool Login(string user, string password) {
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOUR DOMAIN WITH ACTIVE DIRECTORY"))
{
return pc.ValidateCredentials(user, password);
}
}
希望对您有所帮助!祝你好运!
如果您尝试使用 Firefox、Seamonkey 并且可能 Chrome,您应该会看到一个弹出窗口。如果你想用 Internet Explorer 弹出窗口,试试这个:
工具 |互联网选项 |安全 |本地 Intranet(或其他区域)|自定义级别 |用户认证 |提示输入用户名和密码
编辑:您可以在菜单栏上找到工具。如果您没有看到菜单栏,请通过右键单击选项卡附近的某处并启用菜单栏来打开它。看截图: