簡體   English   中英

針對遠程服務器和域進行身份驗證(C#/ 3.5)

[英]Authenticating against a remote server and domain (C#/3.5)

我有在獨立計算機上運行的.Net 3.5服務。 該服務查詢多個Active Directory域中服務器的事件日志。 我想使用托管代碼對它們進行身份驗證。

目前,我通過p /調用WNetAddConnection2A進行身份驗證,或者通過凈使用進行身份驗證。 例如,這有效:

string user = "domain\\administrator";
string pass = "password";
string server = "server.domain.com";
string argument = String.Format("use \\\\{0}\\ipc$ /user:{1} {2}", server, user, pass);
System.Diagnostics.Process.Start("net.exe", argument);
System.Diagnostics.EventLog log = new EventLog("System", server);

.Net 3.5框架中是否有一種方法可以驗證和讀取事件日志,而不必發出或調用非托管代碼?

您是否看過“ System.Security.Principal.WindowsImpersonationContext”和用MSDN編寫的演示。

回溯過去,在.NET 1.1天內,我不得不編寫Windows服務來驗證2個Windows域中的用戶,使用LDAP-和WindowsImpersonation作為故障回復。

我記得我收到了CodeProject和Google:-S的檢舉

/ Erling Damsgaard DNS-IT ApS

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM