惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
P
Privacy & Cybersecurity Law Blog
SecWiki News
SecWiki News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
The Exploit Database - CXSecurity.com
博客园_首页
Latest news
Latest news
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
罗磊的独立博客
月光博客
月光博客
C
Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
MyScale Blog
MyScale Blog
Spread Privacy
Spread Privacy
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
G
GRAHAM CLULEY
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
人人都是产品经理
人人都是产品经理
K
Kaspersky official blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
量子位
I
Intezer
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
D
DataBreaches.Net
宝玉的分享
宝玉的分享
S
Security @ Cisco Blogs
Help Net Security
Help Net Security
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 星宿.NET

MOSS SSO -2147217900调用 SPS Single Sign-on 失败。返回的错误代码为“-2147217900”。 错误 数据关系图出现“此数据库没有有效所有者”错误的解决方法 - 星宿.NET - 博客园 SQL 语句建立连接服务器 SQL语句进行left join的时候发生Cannot resolve collation conflict for equal to operation.错误 跟我一起学Windows Workflow Foundation(7)-----给定制活动添加有效性验证 跟我一起学Windows Workflow Foundation(6)-----制作一个基本的定制活动 treeview控制checkbox修改版(2) treeview控制checkbox修改版(1) [转载]Asp.Net2.0权限树中Checkbox的操作 通过WPF/E制作一个从数据库读取数据的图谱 [转载]如何使用 Visual C# 2005 或 Visual C# .NET 向 Excel 工作簿传输数据 跟我一起学Windows Workflow Foundation(5)-----使用activity设计器创建一个整合的定制activity 跟我一起学Windows Workflow Foundation(4)-----使用Listen,Delay,和其他envnt-based定制活动 跟我一起学Windows Workflow Foundation(3)-----使用If/Else活动,定制活动处理工作流,使用事件传递数据 和我一起学Windows Workflow Foundation(2)-----让WF通过参数接收数据 和我一起学Windows Workflow Foundation(1)-----创建和调试一个WF实例 将visual studio 2005 SP1补丁整合到安装文件 初学使用sharepoint 2007 用户控件包装器 QuickPart 创建或修改WSS的主题
列出域中所有用户的代码
星宿.NET · 2007-05-10 · via 博客园 - 星宿.NET
   

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.DirectoryServices;

namespace WebAppLDAP
{
    
public partial class _Default : System.Web.UI.Page
    
{
        
protected void Page_Load(object sender, EventArgs e)
        
{
            
//ListAllUser();
            showUser();
        }

        
protected void showUser()
        
{
            DirectoryEntry entry 
= new DirectoryEntry("LDAP://ABC.COM.CN");
            System.DirectoryServices.DirectorySearcher mySearcher 
= new System.DirectoryServices.DirectorySearcher(entry);

            mySearcher.Filter 
= "(&(objectClass=user)(objectCategory=person))";

            mySearcher.PropertiesToLoad.Add(
"name"); //用户名
            mySearcher.PropertiesToLoad.Add("samaccountname"); //用户帐号

            SearchResultCollection resultCol 
= mySearcher.FindAll();

            
foreach (SearchResult result in resultCol)
            
{
                ResultPropertyCollection props 
= result.Properties;

                
foreach (string propName in props.PropertyNames)
                
{
                    
//Response.Write(props[propName][0] + "<BR>");
                    if (propName == "name")
                    
{
                        Response.Write(props[propName][
0+ "<BR>");
                    }

                    
if (propName == "samaccountname")
                    
{
                        Response.Write(props[propName][
0+ "<BR><BR>");
                    }

                }

            }

        }

    }

}