当前位置: 首页 > news >正文

旅游网站建设方案/网站开发的一般流程

旅游网站建设方案,网站开发的一般流程,网站开发服务合同模板,那家b2c网站建设报价一、DirectoryEntry类的Path属性 Path 属性唯一地标识网络环境中的此项。始终可以使用此 Path 检索此项。 设置 Path 将从目录存储区检索新项;它不更改当前绑定的项的路径。 与 DirectoryEntry 组件关联的类可以与任何 Active Directory 服务提供程序一起使用。当…
一、DirectoryEntry类的Path属性

Path 属性唯一地标识网络环境中的此项。始终可以使用此 Path 检索此项。

设置 Path 将从目录存储区检索新项;它不更改当前绑定的项的路径。

与 DirectoryEntry 组件关联的类可以与任何 Active Directory 服务提供程序一起使用。当前的一些提供程序包括 Internet 信息服务 (IIS)、轻量目录访问协议 (LDAP)、Novell NetWare 目录服务 (NDS) 和 WinNT。

注意    Path 的一部分,它标识提供程序(在“://”前面),并且区分大小写。例如,“LDAP://”或“WinNT://”。

Path 属性的语法随提供程序不同而不同。一些常见的情况有:

WinNT

  • 连接到计算机上的组。例如“WinNT://<域名>/<计算机名>/<组名>”。如果是连接到本地计算机,则为“WinNT://<计算机名>/<组名>”。
  • 连接到计算机上的用户。例如“WinNT://<域名>/<计算机名>/<用户名>”。如果是连接到本地计算机,则为“WinNT://<计算机名>/<用户名>”。
  • 连接到计算机上的服务。例如,“WinNT://<域名>/<计算机名>/<服务名>”。如果是连接到本地计算机,则为“WinNT://<计算机名>/<服务名>”。
  • 发现网络上的所有域。例如,“WinNT:”。通过枚举此项的子级可以找到这些域。

LDAP

  • 连接到域中的组。例如“LDAP://CN=<组名>, CN =<用户>, DC=<域控制器 1>, DC=<域控制器 2>,...”。
  • 连接到域中的用户。例如“LDAP://CN=<完整用户名>, CN=<用户>, DC=<域控制器 1>, DC=<域控制器 2>,...”。
  • 连接到域中的计算机。例如“LDAP://CN=<计算机名>, CN=<计算机>, DC=<域控制器 1>, DC=<域控制器 2>,...”。

IIS

  • 连接到 Web 目录。例如“IIS://LocalHost/W3SVC/1/ROOT/<Web 目录名>”。
引用地址:DirectoryEntry.Path

二、跟目录服务相关的几个接口
跟目录服务相关的几个接口包括 IADs,IADsContainer,IADsUser,IADsGroup等,详细资料请参考MSDN。

三、列举本机的用户,用户组及Windows服务
运行效果:
untitled.gif

示例代码:
None.gifprivate void RefreshDirectory()
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string path = "WinNT://" + System.Environment.MachineName;
InBlock.gif            DirectoryEntry entryPC 
= new DirectoryEntry(path);
InBlock.gif            TreeNode users 
= new TreeNode("Users");
InBlock.gif            TreeNode groups 
= new TreeNode("Groups");
InBlock.gif            TreeNode services 
= new TreeNode("Services");
ExpandedSubBlockStart.gifContractedSubBlock.gif            viewPC.Nodes.AddRange(
new TreeNode[] dot.gif{ users, groups, services });
InBlock.gif
InBlock.gif            
foreach(System.DirectoryServices.DirectoryEntry child 
InBlock.gif                        
in entryPC.Children) 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                TreeNode newNode 
= new TreeNode(child.Name);
InBlock.gif                
switch (child.SchemaClassName) 
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
case "User" :
InBlock.gif                        users.Nodes.Add(newNode);   
InBlock.gif                        
break;
InBlock.gif                    
case "Group" :
InBlock.gif                        groups.Nodes.Add(newNode);   
InBlock.gif                        
break;
InBlock.gif                    
case "Service" :
InBlock.gif                        services.Nodes.Add(newNode);   
InBlock.gif                        
break;
ExpandedSubBlockEnd.gif                }

InBlock.gif                AddPathAndProperties(newNode, child);
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

None.gif
None.gif        
private void AddPathAndProperties(TreeNode node, 
None.gif            System.DirectoryServices.DirectoryEntry entry)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            node.Nodes.Add(
new TreeNode("Path: " + entry.Path));
InBlock.gif            TreeNode propertyNode 
= new TreeNode("Properties");
InBlock.gif            node.Nodes.Add(propertyNode);
InBlock.gif            
foreach (string propertyName in entry.Properties.PropertyNames) 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
string oneNode = propertyName + "" + 
InBlock.gif                    entry.Properties[propertyName][
0].ToString();
InBlock.gif                propertyNode.Nodes.Add(
new TreeNode(oneNode));
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

四、新增组:
None.gifprivate void button3_Click(object sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string path = String.Format("WinNT://{0}",System.Environment.MachineName);
InBlock.gif            DirectoryEntry entryPC 
= new DirectoryEntry(path);
InBlock.gif            DirectoryEntry newEntry 
= entryPC.Children.Add("NewGroup","Group");
InBlock.gif            
//newEntry.Properties["groupType"][0] = "4";
InBlock.gif
            newEntry.Properties["Description"].Add("test");
InBlock.gif            newEntry.CommitChanges();
ExpandedBlockEnd.gif        }

五、删除组:
None.gifprivate void button6_Click(object sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string userGroup = "NewGroup";
InBlock.gif            
string path1 = String.Format("WinNT://{0}",System.Environment.MachineName);
InBlock.gif            DirectoryEntry parent 
= new DirectoryEntry(path1);
InBlock.gif            
object[] paras = new object[2];
InBlock.gif            paras[
0= "group"
InBlock.gif            paras[
1= userGroup;
InBlock.gif            parent.Invoke(
"Delete",paras);
ExpandedBlockEnd.gif        }

六、查找组:
None.gifprivate void button8_Click(object sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string userGroup = "NewGroup";
InBlock.gif            
string path1 = String.Format("WinNT://{0}",System.Environment.MachineName);
InBlock.gif            DirectoryEntry parent 
= new DirectoryEntry(path1);
InBlock.gif            DirectoryEntry group 
= parent.Children.Find(userGroup,"group");
InBlock.gif            
if(group != null)
InBlock.gif                MessageBox.Show(
"Group find.");
InBlock.gif            
else
InBlock.gif                MessageBox.Show(
"Group not found.");
ExpandedBlockEnd.gif        }

七、新增用户:
None.gifprivate void button4_Click(object sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string path = String.Format("WinNT://{0}",System.Environment.MachineName);
InBlock.gif            DirectoryEntry entryPC 
= new DirectoryEntry(path);
InBlock.gif            DirectoryEntry obUser 
= entryPC.Children.Add("NewUser","User");
InBlock.gif            obUser.Properties[
"Description"].Add("Test User from .NET");
InBlock.gif            obUser.Properties[
"FullName"].Add("NewUser");
InBlock.gif            
object obRet = obUser.Invoke("SetPassword""123");
InBlock.gif            obUser.CommitChanges();
ExpandedBlockEnd.gif        }

八、删除用户:
None.gifprivate void button5_Click(object sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string userName = "NewUser";
InBlock.gif            
string path1 = String.Format("WinNT://{0}",System.Environment.MachineName);
InBlock.gif            DirectoryEntry parent 
= new DirectoryEntry(path1);
InBlock.gif            
object[] paras = new object[2];
InBlock.gif            paras[
0= "user"
InBlock.gif            paras[
1= userName;
InBlock.gif            parent.Invoke(
"Delete",paras);
ExpandedBlockEnd.gif        }

九、查找用户:
None.gifprivate void button7_Click(object sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
string userName = "NewUser";
InBlock.gif            
string path1 = String.Format("WinNT://{0}",System.Environment.MachineName);
InBlock.gif            DirectoryEntry parent 
= new DirectoryEntry(path1);
InBlock.gif            DirectoryEntry user 
= parent.Children.Find(userName,"user");
InBlock.gif            
if(user != null)
InBlock.gif                MessageBox.Show(
"User find.");
InBlock.gif            
else
InBlock.gif                MessageBox.Show(
"User not found.");
ExpandedBlockEnd.gif        }

参考页:How to add a new user using DirectoryServices?

转载于:https://www.cnblogs.com/zengdj/archive/2005/08/10/211346.html

http://www.lbrq.cn/news/1247131.html

相关文章:

  • 百度最容易收录的网站/郑州网络推广厂家
  • 网站后台浏览器/网站制作的基本流程是什么
  • 怎么做一键添加信任网站/百度竞价ocpc投放策略
  • wordpress标签分级/seo推广效果
  • 昆明网站建设咨询/网站关键词优化排名
  • 怎样 管理网站/北京做网站的公司有哪些
  • 网站建设及应用实施方案/平台连接
  • b站视频推广网站动漫/企业营销型网站
  • 建网站广州/外贸seo软文发布平台
  • 查找手机网站/网站友情链接
  • 手机网站开发下载/电商seo
  • 瑞安网站/企业查询系统官网
  • 购物网页设计/河南seo关键词排名优化
  • 免费seo工具/seo学院
  • 商城网站开发文档/百度推广需要什么条件
  • 聊城网站建设包括哪些/n127网推广
  • 手机网站整站模板下载/郑州网站优化seo
  • 淘宝做任务赚钱网站/百度域名注册
  • 东莞教育平台网站建设/宁波百度seo排名优化
  • 色盲/搜索引擎优化的含义
  • Asp.net 手机网站制作/互联网100个创业项目
  • 顺义重庆网站建设/关键词挖掘排名
  • 广州网站开发公司有哪些/海会网络做的网站怎么做优化
  • 地球人--一家只做信誉的网站/北京云无限优化
  • 秦皇岛做网站的公司哪家好/当日alexa排名查询统计
  • 限制访问次数的网站/电商运营一天都干啥
  • wordpress价格表单/2022年百度seo
  • 做网站一般图片多大/广告优化师发展前景
  • 网站做优化每天一定要更新/网站推广的四个阶段
  • 优质手机网站建设/网站推广多少钱
  • Hyperbrowser MCP:重新定义网页抓取与浏览器自动化的AI驱动工具
  • Excel文件解析
  • 【Django】-1- 开发项目搭建
  • RHCA学习概述
  • Python 程序设计讲义(45):组合数据类型——集合类型:集合的常用操作
  • 第2章 cmd命令基础:常用基础命令(2)