![](/img/trans.png)
[英]Get domain\user in a intranet using authentication mode = “forms”
[英]Domain user automatic autentication for intranet
我正在開發一個內部網應用程序。 該應用程序正在Windows服務器2008上的IIS上工作。我正在使用C#編寫ASP.NET。
所以,我只想允許屬於OU ICT的域用戶。 我不想要登錄表單,只需要自動身份驗證。
Sql Server Reporting Services的工作原理如下。 用戶無需登錄,安全性基於AD。 - >正是我正在尋找的東西。
我嘗試了幾種方法,比如WidowsImpersonationContext,我在OU上遇到了死胡同。
如果有人可以幫助我,我會非常感激。
解決了我檢查用戶是否在組/ ou中的部分。
問候,傑夫
我不確定OU和群組之間的混合物,但是以下內容可能對您有所幫助:
參考System.DirectoryServices.AccountManagement,
var pc = new PrincipalContext(ContextType.Domain);
var user = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName,"DOMAIN\\USER");
var g = System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(pc, IdentityType.DistinguishedName, "Everyone");
var check = user.IsMemberOf(g);
HTH Dominik
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.