我們在我們的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