当前位置: 首页>>代码示例>>C#>>正文


C# ActiveDirectory.DirectoryContext类代码示例

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


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


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