我们在我们的Intranet站点上遇到类似问题,最终从集成Windows身份验证切换到直接在网站上请求其网络用户名/密码。这样我们可以将它们重定向到HTTPS或其他类似的东西,而不用担心验证弹出窗口的时间。
我们有一些类似于此的代码(假设您使用ASP.NET)对用户进行身份验证,然后我们将身份验证状态存储在cookie中。
public static bool AuthenticateUser(string username, string password)
{
System.DirectoryServices.DirectoryEntry _entry = new System.DirectoryServices.DirectoryEntry(ldap_path, username, password, System.DirectoryServices.AuthenticationTypes.Delegation);
bool _authenticated = false;
try
{
Object _o = _entry.NativeObject;
_authenticated = true;
}
catch
{
_authenticated = false;
}
finally
{
// Avoids the "multiple connections to server not allowed" error.
_entry.Close();
_entry.Dispose();
}
return _authenticated;
}
它结束了通过处理所有身份验证的应用程序,而不是依赖于IIS我们节省吨头痛和无奈。
感谢您的回复。无论如何,我开始倾向于关闭集成身份验证,因为它知道它可能无法在建筑物外工作。 – 2009-10-21 21:20:27
是否有任何特定的原因,您决定不使用会员提供商的功能,并推出自己的? – 2009-10-22 17:33:49
我们已经有了一个长期存在的数据结构,它不会与标准的.NET成员资格提供程序功能一起工作。 我们可以实现自己的继承自MembershipProvider的类,但我们不需要它所需的所有属性和方法,所以我们决定改为创建自己的精简版。 – JoshMock 2009-10-23 17:13:43