• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ActiveDirectory.DirectoryContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.DirectoryServices.ActiveDirectory.DirectoryContext的典型用法代码示例。如果您正苦于以下问题:C# DirectoryContext类的具体用法?C# DirectoryContext怎么用?C# DirectoryContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DirectoryContext类属于System.DirectoryServices.ActiveDirectory命名空间,在下文中一共展示了DirectoryContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConfigurationSet

 internal ConfigurationSet(DirectoryContext context, string configSetName, DirectoryEntryManager directoryEntryMgr)
 {
     this.cachedSecurityLevel = ~ReplicationSecurityLevel.NegotiatePassThrough;
     this.context = context;
     this.configSetName = configSetName;
     this.directoryEntryMgr = directoryEntryMgr;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ConfigurationSet.cs


示例2: ApplicationPartition

 public ApplicationPartition(DirectoryContext context, string distinguishedName)
 {
     this.appType = ApplicationPartitionType.Unknown;
     this.committed = true;
     this.ValidateApplicationPartitionParameters(context, distinguishedName, null, false);
     this.CreateApplicationPartition(distinguishedName, "domainDns");
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ApplicationPartition.cs


示例3: ReplicationConnection

 internal ReplicationConnection(DirectoryContext context, DirectoryEntry connectionEntry, string name)
 {
     this.context = context;
     this.cachedDirectoryEntry = connectionEntry;
     this.connectionName = name;
     this.existingConnection = true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ReplicationConnection.cs


示例4: ActiveDirectorySubnetCollection

 internal ActiveDirectorySubnetCollection(DirectoryContext context, string siteDN)
 {
     this.context = context;
     this.siteDN = siteDN;
     Hashtable table = new Hashtable();
     this.changeList = Hashtable.Synchronized(table);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ActiveDirectorySubnetCollection.cs


示例5: ActiveDirectorySubnet

 public ActiveDirectorySubnet(DirectoryContext context, string subnetName)
 {
     ValidateArgument(context, subnetName);
     context = new DirectoryContext(context);
     this.context = context;
     this.name = subnetName;
     DirectoryEntry directoryEntry = null;
     try
     {
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
         string str = (string) PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
         string dn = "CN=Subnets,CN=Sites," + str;
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, dn);
         string escapedPath = Utils.GetEscapedPath("cn=" + this.name);
         this.cachedEntry = directoryEntry.Children.Add(escapedPath, "subnet");
     }
     catch (COMException exception)
     {
         ExceptionHelper.GetExceptionFromCOMException(context, exception);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
     }
     finally
     {
         if (directoryEntry != null)
         {
             directoryEntry.Dispose();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:ActiveDirectorySubnet.cs


示例6: FindByName

    // it seems it may return null?
    public static ReplicationConnection FindByName(DirectoryContext context, string name)
    {
      Contract.Requires(context != null);
      Contract.Requires(!string.IsNullOrEmpty(name));

      return default(ReplicationConnection);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:System.DirectoryServices.ActiveDirectory.ReplicationConnection.cs


示例7: FriendlyDomainToLdapDomain

        public static string FriendlyDomainToLdapDomain(string friendlyDomainName)
        {
            DirectoryContext objContext = new DirectoryContext(DirectoryContextType.Domain, friendlyDomainName);
            Domain domain = Domain.GetDomain(objContext);

            return domain.Name;
        }
开发者ID:wangn6,项目名称:rep2,代码行数:7,代码来源:ADDomain.cs


示例8: FindAll

    public static DomainControllerCollection FindAll(DirectoryContext context)
    {
      Contract.Requires(context != null);
      Contract.Requires(context.ContextType == DirectoryContextType.Domain);

      return default(DomainControllerCollection);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.DirectoryServices.ActiveDirectory.DomainController.cs


示例9: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // TODO this todo was here for ages
            var dc = new DirectoryContext(DirectoryContextType.Domain, "ptsecurity.ru");

            var address = Request.Params["address"];
            var filter = "Address=" + address;
            var result = "";

            var domain = Domain.GetDomain(dc);

            // this is our vulnerabilitiy of LDAP injection *in this file*
            // FIXED: AI issue #3, High, LDAP Injection, https://github.com/SDLTestAccount/IT/issues/3
            // GET /Tests/1 INPUT DATA VERIFICATION/9 LDAP Injection/Ldap.aspx?address=%7bfilter%7d+%3d+* HTTP/1.1
            // Host:localhost
            var ds = new DirectorySearcher(domain.GetDirectoryEntry());//, filter);

            using (var src = ds.FindAll())
            {
                // TODO it was edit here by developer 1 year ago
                foreach (var res in src)
                {
                    result = res.ToString();
                }
            }

            // let's go

            // this is our first vulnerability of XSS in this file
            // we will demonstrate False Positive scenario here (FP Marker)
            // FP: AI issue #4, High, Cross-site Scripting, https://github.com/SDLTestAccount/IT/issues/4
            // GET /Tests/1 INPUT DATA VERIFICATION/9 LDAP Injection/Ldap.aspx HTTP/1.1
            // Host:localhost
            // (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().MoveNext() && (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().Current.ToString() == "<script>alert(0)</script>"))
            Response.Write(result);

            // this is our second vulnerability of XSS in this file
            // we will demonstrate what happen if developer fails with his fix (VERIFY Marker)
            // FIXED: AI issue #4, High, Cross-site Scripting, https://github.com/SDLTestAccount/IT/issues/4
            // GET /Tests/1 INPUT DATA VERIFICATION/9 LDAP Injection/Ldap.aspx HTTP/1.1
            // Host:localhost
            // (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().MoveNext() && (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().Current.ToString() == "<script>alert(0)</script>"))
            Response.Write("result");

            // this is our third vulnerability of XSS in this file
            // we will demonstrate what happen if we really fix vulnerability (VERIFY Marker)
            // FIXED: AI issue #4, High, Cross-site Scripting, https://github.com/SDLTestAccount/IT/issues/4
            // GET /Tests/1 INPUT DATA VERIFICATION/9 LDAP Injection/Ldap.aspx HTTP/1.1
            // Host:localhost
            // (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().MoveNext() && (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().Current.ToString() == "<script>alert(0)</script>"))
            Response.Write("result");

            // this is our fourth vulnerability of XSS in this file
            // we will demonstrate what happen if developer want to cheat (FIXED Marker)
            // FIXED: AI issue #4, High, Cross-site Scripting, https://github.com/SDLTestAccount/IT/issues/4
            // GET /Tests/1 INPUT DATA VERIFICATION/9 LDAP Injection/Ldap.aspx HTTP/1.1
            // Host:localhost
            // (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().MoveNext() && (System.DirectoryServices.DirectorySearcher.FindAll().GetEnumerator().Current.ToString() == "<script>alert(0)</script>"))
            Response.Write("result");
        }
开发者ID:PDUGTestAccount,项目名称:IT,代码行数:60,代码来源:Ldap.aspx.cs


示例10: CreateAdamSite

        public static void CreateAdamSite(string targetName, string newSiteName)
        {
            try
            {
                // assemble the connection string using the host name and the port assigned to ADAM
                string adamConnectionString = targetName;

                DirectoryContext adamContext = new DirectoryContext(
                                                    DirectoryContextType.DirectoryServer,
                                                    adamConnectionString);

                ActiveDirectorySite site = new ActiveDirectorySite(adamContext,
                                                                   newSiteName);

                // set site options
                site.Options = ActiveDirectorySiteOptions.GroupMembershipCachingEnabled;

                // commit the site to the directory
                site.Save();
                Console.WriteLine("\nSite \"{0}\" was created successfully", site);

            }
            catch (Exception e)
            {
                Console.WriteLine("\r\nUnexpected exception occured:\n\t{0}\n{1}",
                                  e.GetType().Name, e.Message);
            }
        }
开发者ID:azun5290,项目名称:Directory-Services-Development,代码行数:28,代码来源:TopologyManagement.cs


示例11: ApplicationPartition

 // Internal Constructors
 internal ApplicationPartition(DirectoryContext context, string distinguishedName, string dnsName, ApplicationPartitionType appType, DirectoryEntryManager directoryEntryMgr)
     : base(context, distinguishedName)
 {
     this.directoryEntryMgr = directoryEntryMgr;
     _appType = appType;
     _dnsName = dnsName;
 }
开发者ID:chcosta,项目名称:corefx,代码行数:8,代码来源:ApplicationPartition.cs


示例12: ActiveDirectorySchemaProperty

 public ActiveDirectorySchemaProperty(DirectoryContext context, string ldapDisplayName)
 {
     this.syntax = ~ActiveDirectorySyntax.CaseExactString;
     this.rangeLower = null;
     this.rangeUpper = null;
     this.linkId = null;
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if ((context.Name == null) && !context.isRootDomain())
     {
         throw new ArgumentException(Res.GetString("ContextNotAssociatedWithDomain"), "context");
     }
     if (((context.Name != null) && !context.isRootDomain()) && (!context.isADAMConfigSet() && !context.isServer()))
     {
         throw new ArgumentException(Res.GetString("NotADOrADAM"), "context");
     }
     if (ldapDisplayName == null)
     {
         throw new ArgumentNullException("ldapDisplayName");
     }
     if (ldapDisplayName.Length == 0)
     {
         throw new ArgumentException(Res.GetString("EmptyStringParameter"), "ldapDisplayName");
     }
     this.context = new DirectoryContext(context);
     this.schemaEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.SchemaNamingContext);
     this.schemaEntry.Bind(true);
     this.ldapDisplayName = ldapDisplayName;
     this.commonName = ldapDisplayName;
     this.isBound = false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:ActiveDirectorySchemaProperty.cs


示例13: TrustRelationshipInformation

		internal TrustRelationshipInformation(DirectoryContext context, string source, TrustObject obj)
		{
			string netbiosDomainName;
			this.context = context;
			this.source = source;
			TrustRelationshipInformation trustRelationshipInformation = this;
			if (obj.DnsDomainName == null)
			{
				netbiosDomainName = obj.NetbiosDomainName;
			}
			else
			{
				netbiosDomainName = obj.DnsDomainName;
			}
			trustRelationshipInformation.target = netbiosDomainName;
			if ((obj.Flags & 2) == 0 || (obj.Flags & 32) == 0)
			{
				if ((obj.Flags & 2) == 0)
				{
					if ((obj.Flags & 32) != 0)
					{
						this.direction = TrustDirection.Inbound;
					}
				}
				else
				{
					this.direction = TrustDirection.Outbound;
				}
			}
			else
			{
				this.direction = TrustDirection.Bidirectional;
			}
			this.type = obj.TrustType;
		}
开发者ID:nickchal,项目名称:pash,代码行数:35,代码来源:TrustRelationshipInformation.cs


示例14: ForestTrustRelationshipInformation

        internal ForestTrustRelationshipInformation(DirectoryContext context, string source, DS_DOMAIN_TRUSTS unmanagedTrust, TrustType type)
        {
            string tmpDNSName = null;
            string tmpNetBIOSName = null;

            // security context
            this.context = context;
            // source 
            this.source = source;
            // target
            if (unmanagedTrust.DnsDomainName != (IntPtr)0)
                tmpDNSName = Marshal.PtrToStringUni(unmanagedTrust.DnsDomainName);
            if (unmanagedTrust.NetbiosDomainName != (IntPtr)0)
                tmpNetBIOSName = Marshal.PtrToStringUni(unmanagedTrust.NetbiosDomainName);

            this.target = (tmpDNSName == null ? tmpNetBIOSName : tmpDNSName);
            // direction
            if ((unmanagedTrust.Flags & (int)DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND) != 0 &&
                (unmanagedTrust.Flags & (int)DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND) != 0)
                direction = TrustDirection.Bidirectional;
            else if ((unmanagedTrust.Flags & (int)DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND) != 0)
                direction = TrustDirection.Outbound;
            else if ((unmanagedTrust.Flags & (int)DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND) != 0)
                direction = TrustDirection.Inbound;
            // type
            this.type = type;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:27,代码来源:ForestTrustRelationshipInformation.cs


示例15: DirectoryEntryManager

		//private NativeComInterfaces.IAdsPathname pathCracker;

		internal DirectoryEntryManager(DirectoryContext context)
		{
			this.directoryEntries = new Hashtable();
			this.context = context;
			//this.pathCracker = (NativeComInterfaces.IAdsPathname)(new NativeComInterfaces.Pathname());
			//this.pathCracker.EscapedMode = 2;
		}
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:DirectoryEntryManager.cs


示例16: ActiveDirectorySubnetCollection

        internal ActiveDirectorySubnetCollection(DirectoryContext context, string siteDN)
        {
            _context = context;
            _siteDN = siteDN;

            Hashtable tempTable = new Hashtable();
            changeList = Hashtable.Synchronized(tempTable);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:8,代码来源:ActiveDirectorySubnetCollection.cs


示例17: FindOne

    public static System.DirectoryServices.ActiveDirectory.DomainController FindOne(DirectoryContext context, string siteName)
    {
      Contract.Requires(context != null);
      Contract.Requires(context.ContextType == DirectoryContextType.Domain);
      Contract.Requires(siteName != null);

      return default(System.DirectoryServices.ActiveDirectory.DomainController);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:System.DirectoryServices.ActiveDirectory.DomainController.cs


示例18: ActiveDirectorySiteLinkBridge

 internal ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport, bool existing)
 {
     this.links = new ActiveDirectorySiteLinkCollection();
     this.context = context;
     this.name = bridgeName;
     this.transport = transport;
     this.existing = existing;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ActiveDirectorySiteLinkBridge.cs


示例19: FindByTransportType

    public static ActiveDirectoryInterSiteTransport FindByTransportType(DirectoryContext context, ActiveDirectoryTransportType transport)
    {
      Contract.Requires(context != null);

      Contract.Ensures(Contract.Result<ActiveDirectoryInterSiteTransport>() != null);

      return default(ActiveDirectoryInterSiteTransport);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:System.DirectoryServices.ActiveDirectory.ActiveDirectoryInterSiteTransport.cs


示例20: FindByName

    public static ActiveDirectorySchemaClass FindByName(DirectoryContext context, string ldapDisplayName)
    {
      Contract.Requires(context != null);

      Contract.Ensures(Contract.Result<ActiveDirectorySchemaClass>() != null);

      return default(System.DirectoryServices.ActiveDirectory.ActiveDirectorySchemaClass);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:System.DirectoryServices.ActiveDirectory.ActiveDirectorySchemaClass.cs



注:本文中的System.DirectoryServices.ActiveDirectory.DirectoryContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Protocols.LdapConnection类代码示例发布时间:2022-05-26
下一篇:
C# AccountManagement.UserPrincipal类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap