|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why am I getting errors when I want to rebuild the TreeView controtree using this new domain so I pass in the new DNS. I update that in the DirectoryEntry object's path. But I'm getting the following error message: DirectoryServicesCOMException(ox8007202B): A referral was returned from the server. The error occurs at "foreach (DirectoryEntry child in deContexts.Children)" Can someone see what I need to corret here? Thanks. --------------------------------------------------- public void InitTree(string domainName) { string newDomain = domainName; //Obtain and lists all the contexts nodes contextPath = "CN=Contexts,CN=Unity,CN=Symark,CN=Program Data," + newDomain; globalPath = "CN=Global,CN=Unity,CN=Symark,CN=Program Data," + newDomain; defaultPath = "CN=Contexts, CN=DEFAULTS,CN=Unity,CN=Symark,CN=Program Data," + newDomain; try { deContexts.Path = "LDAP://" + contextPath; string path = deContexts.Path; } catch (System.Exception e) { MessageBox.Show(e.ToString(), "PowerADvantage"); return; } this.ppTree.Nodes.Clear(); this.ppTree.ImageList = unityImageList; // Set the TreeView control's default image and selected image indexes. this.ppTree.ImageIndex = 0; this.ppTree.SelectedImageIndex = 1; TreeNode unityNode = new TreeNode("PowerADvantage Administration", 5, 5); unityNode.Name = "PowerADvantage Administration"; this.ppTree.Nodes.Add(unityNode); //Tag the 1st Tree Node this.ppTree.Nodes[0].Tag = new TreeNodeInfo(deContexts.Path, true); int index = 0; TreeNode tn = unityNode.Nodes.Add("domainRoot", "Contexts", 6, 6); tn.Name = "Contexts"; tn.Tag = new TreeNodeInfo(deContexts.Path, true); TreeNodeInfo nodeInfo = (TreeNodeInfo)tn.Tag; //this.ppTree.SelectedNode = unityNode; //Populate the tree nodes try { foreach (DirectoryEntry child in deContexts.Children) { string delimStr = "="; char[] delimiter = delimStr.ToCharArray(); string[] split = null; split = child.Name.Split(delimiter, 2); index = tn.Nodes.Add(new TreeNode(split[1].ToString(), 0, 1)); tn.Nodes[index].Tag = new TreeNodeInfo(child.Path, false); tn.Nodes[index].Name = split[1].ToString(); } } catch (System.Exception e) { MessageBox.Show(e.ToString(), "PowerADvantage"); } //Add the Reports node TreeNode reportNode = new TreeNode("Reports", 8, 8); TreeNode licensesNode = new TreeNode("Licenses", 10, 10); //TreeNode computerDetail = new TreeNode("Computers - Detail", 9, 9); //TreeNode groupDetailDetail = new TreeNode("Groups - Detail", 9, 9); //TreeNode userDetail = new TreeNode("Users - Detail", 9, 9); //TreeNode contextsDetail = new TreeNode("Contexts - Detail", 9, 9); unityNode.Nodes.Add(reportNode); //reportNode.Nodes.Add(computerDetail); //reportNode.Nodes.Add(groupDetailDetail); //reportNode.Nodes.Add(userDetail); //reportNode.Nodes.Add(contextsDetail); unityNode.Nodes.Add(licensesNode); curDomain = newDomain; nodeInfo.isLoaded = true; this.ppTree.ExpandAll(); } -- Thanks. You need to add the DNS domain name of the domain you want to access to the
ADsPath if the domain is different from the domain the current user is in. Serverless binding (like you are doing) will always go to the current domain. Joe K. -- Show quoteHide quoteJoe Kaplan-MS MVP Directory Services Programming Co-author of "The .NET Developer's Guide to Directory Services Programming" http://www.directoryprogramming.net -- "Pucca" <Pu***@discussions.microsoft.com> wrote in message news:E2C0C72B-F537-4251-AF4B-2DCB324A8049@microsoft.com... > Hi, I'm able to get the Domain object using GetDomain . I want to rebuild > my > tree using this new domain so I pass in the new DNS. I update that in the > DirectoryEntry object's path. But I'm getting the following error > message: > > DirectoryServicesCOMException(ox8007202B): A referral was returned from > the > server. > > The error occurs at > "foreach (DirectoryEntry child in deContexts.Children)" > > > Can someone see what I need to corret here? Thanks. > --------------------------------------------------- > public void InitTree(string domainName) > { > string newDomain = domainName; > > > //Obtain and lists all the contexts nodes > contextPath = "CN=Contexts,CN=Unity,CN=Symark,CN=Program Data," > + newDomain; > globalPath = "CN=Global,CN=Unity,CN=Symark,CN=Program Data," > + newDomain; > defaultPath = "CN=Contexts, > CN=DEFAULTS,CN=Unity,CN=Symark,CN=Program Data," > + newDomain; > > try > { > deContexts.Path = "LDAP://" + contextPath; > string path = deContexts.Path; > } > catch (System.Exception e) > { > MessageBox.Show(e.ToString(), "PowerADvantage"); > return; > } > > this.ppTree.Nodes.Clear(); > this.ppTree.ImageList = unityImageList; > > // Set the TreeView control's default image and selected image > indexes. > this.ppTree.ImageIndex = 0; > this.ppTree.SelectedImageIndex = 1; > > > TreeNode unityNode = new TreeNode("PowerADvantage > Administration", 5, 5); > unityNode.Name = "PowerADvantage Administration"; > this.ppTree.Nodes.Add(unityNode); > > > //Tag the 1st Tree Node > this.ppTree.Nodes[0].Tag = new TreeNodeInfo(deContexts.Path, > true); > int index = 0; > TreeNode tn = unityNode.Nodes.Add("domainRoot", "Contexts", 6, > 6); > tn.Name = "Contexts"; > > tn.Tag = new TreeNodeInfo(deContexts.Path, true); > TreeNodeInfo nodeInfo = (TreeNodeInfo)tn.Tag; > //this.ppTree.SelectedNode = unityNode; > > //Populate the tree nodes > try > { > foreach (DirectoryEntry child in deContexts.Children) > { > string delimStr = "="; > char[] delimiter = delimStr.ToCharArray(); > string[] split = null; > split = child.Name.Split(delimiter, 2); > > index = tn.Nodes.Add(new TreeNode(split[1].ToString(), > 0, 1)); > tn.Nodes[index].Tag = new TreeNodeInfo(child.Path, > false); > tn.Nodes[index].Name = split[1].ToString(); > > } > } > catch (System.Exception e) > { > MessageBox.Show(e.ToString(), "PowerADvantage"); > } > //Add the Reports node > TreeNode reportNode = new TreeNode("Reports", 8, 8); > TreeNode licensesNode = new TreeNode("Licenses", 10, 10); > > //TreeNode computerDetail = new TreeNode("Computers - Detail", > 9, 9); > //TreeNode groupDetailDetail = new TreeNode("Groups - Detail", > 9, 9); > //TreeNode userDetail = new TreeNode("Users - Detail", 9, 9); > //TreeNode contextsDetail = new TreeNode("Contexts - Detail", > 9, > 9); > > unityNode.Nodes.Add(reportNode); > //reportNode.Nodes.Add(computerDetail); > //reportNode.Nodes.Add(groupDetailDetail); > //reportNode.Nodes.Add(userDetail); > //reportNode.Nodes.Add(contextsDetail); > unityNode.Nodes.Add(licensesNode); > > curDomain = newDomain; > nodeInfo.isLoaded = true; > this.ppTree.ExpandAll(); > } > > -- > Thanks. Thanks Joe that worked out well. However I have to change all the codes that
tries to create a new DirectoryEntry object with the new DNS AND the user name and password. Is there a place where I can change the default binding to the new domain? -- Show quoteHide quoteThanks. "Joe Kaplan" wrote: > You need to add the DNS domain name of the domain you want to access to the > ADsPath if the domain is different from the domain the current user is in. > Serverless binding (like you are doing) will always go to the current > domain. > > Joe K. > > -- > Joe Kaplan-MS MVP Directory Services Programming > Co-author of "The .NET Developer's Guide to Directory Services Programming" > http://www.directoryprogramming.net > -- > "Pucca" <Pu***@discussions.microsoft.com> wrote in message > news:E2C0C72B-F537-4251-AF4B-2DCB324A8049@microsoft.com... > > Hi, I'm able to get the Domain object using GetDomain . I want to rebuild > > my > > tree using this new domain so I pass in the new DNS. I update that in the > > DirectoryEntry object's path. But I'm getting the following error > > message: > > > > DirectoryServicesCOMException(ox8007202B): A referral was returned from > > the > > server. > > > > The error occurs at > > "foreach (DirectoryEntry child in deContexts.Children)" > > > > > > Can someone see what I need to corret here? Thanks. > > --------------------------------------------------- > > public void InitTree(string domainName) > > { > > string newDomain = domainName; > > > > > > //Obtain and lists all the contexts nodes > > contextPath = "CN=Contexts,CN=Unity,CN=Symark,CN=Program Data," > > + newDomain; > > globalPath = "CN=Global,CN=Unity,CN=Symark,CN=Program Data," > > + newDomain; > > defaultPath = "CN=Contexts, > > CN=DEFAULTS,CN=Unity,CN=Symark,CN=Program Data," > > + newDomain; > > > > try > > { > > deContexts.Path = "LDAP://" + contextPath; > > string path = deContexts.Path; > > } > > catch (System.Exception e) > > { > > MessageBox.Show(e.ToString(), "PowerADvantage"); > > return; > > } > > > > this.ppTree.Nodes.Clear(); > > this.ppTree.ImageList = unityImageList; > > > > // Set the TreeView control's default image and selected image > > indexes. > > this.ppTree.ImageIndex = 0; > > this.ppTree.SelectedImageIndex = 1; > > > > > > TreeNode unityNode = new TreeNode("PowerADvantage > > Administration", 5, 5); > > unityNode.Name = "PowerADvantage Administration"; > > this.ppTree.Nodes.Add(unityNode); > > > > > > //Tag the 1st Tree Node > > this.ppTree.Nodes[0].Tag = new TreeNodeInfo(deContexts.Path, > > true); > > int index = 0; > > TreeNode tn = unityNode.Nodes.Add("domainRoot", "Contexts", 6, > > 6); > > tn.Name = "Contexts"; > > > > tn.Tag = new TreeNodeInfo(deContexts.Path, true); > > TreeNodeInfo nodeInfo = (TreeNodeInfo)tn.Tag; > > //this.ppTree.SelectedNode = unityNode; > > > > //Populate the tree nodes > > try > > { > > foreach (DirectoryEntry child in deContexts.Children) > > { > > string delimStr = "="; > > char[] delimiter = delimStr.ToCharArray(); > > string[] split = null; > > split = child.Name.Split(delimiter, 2); > > > > index = tn.Nodes.Add(new TreeNode(split[1].ToString(), > > 0, 1)); > > tn.Nodes[index].Tag = new TreeNodeInfo(child.Path, > > false); > > tn.Nodes[index].Name = split[1].ToString(); > > > > } > > } > > catch (System.Exception e) > > { > > MessageBox.Show(e.ToString(), "PowerADvantage"); > > } > > //Add the Reports node > > TreeNode reportNode = new TreeNode("Reports", 8, 8); > > TreeNode licensesNode = new TreeNode("Licenses", 10, 10); > > > > //TreeNode computerDetail = new TreeNode("Computers - Detail", > > 9, 9); > > //TreeNode groupDetailDetail = new TreeNode("Groups - Detail", > > 9, 9); > > //TreeNode userDetail = new TreeNode("Users - Detail", 9, 9); > > //TreeNode contextsDetail = new TreeNode("Contexts - Detail", > > 9, > > 9); > > > > unityNode.Nodes.Add(reportNode); > > //reportNode.Nodes.Add(computerDetail); > > //reportNode.Nodes.Add(groupDetailDetail); > > //reportNode.Nodes.Add(userDetail); > > //reportNode.Nodes.Add(contextsDetail); > > unityNode.Nodes.Add(licensesNode); > > > > curDomain = newDomain; > > nodeInfo.isLoaded = true; > > this.ppTree.ExpandAll(); > > } > > > > -- > > Thanks. > > > Nope. I suggest you create a factory method of some sort that allows you to
do this and use a centralized mechanism for creating all of your DirectoryEntry objects. This has worked well for me in the past. I have a single piece of code in most of my projects that calls the DirectoryEntry constructor. Joe K. -- Show quoteHide quoteJoe Kaplan-MS MVP Directory Services Programming Co-author of "The .NET Developer's Guide to Directory Services Programming" http://www.directoryprogramming.net -- "Pucca" <Pu***@discussions.microsoft.com> wrote in message news:C7AB5081-B0A3-403F-ACFE-DF616B192F8F@microsoft.com... > Thanks Joe that worked out well. However I have to change all the codes > that > tries to create a new DirectoryEntry object with the new DNS AND the user > name and password. Is there a place where I can change the default > binding > to the new domain? > > > -- > Thanks. > > > "Joe Kaplan" wrote: > >> You need to add the DNS domain name of the domain you want to access to >> the >> ADsPath if the domain is different from the domain the current user is >> in. >> Serverless binding (like you are doing) will always go to the current >> domain. >> >> Joe K. >> >> -- >> Joe Kaplan-MS MVP Directory Services Programming >> Co-author of "The .NET Developer's Guide to Directory Services >> Programming" >> http://www.directoryprogramming.net >> -- >> "Pucca" <Pu***@discussions.microsoft.com> wrote in message >> news:E2C0C72B-F537-4251-AF4B-2DCB324A8049@microsoft.com... >> > Hi, I'm able to get the Domain object using GetDomain . I want to >> > rebuild >> > my >> > tree using this new domain so I pass in the new DNS. I update that in >> > the >> > DirectoryEntry object's path. But I'm getting the following error >> > message: >> > >> > DirectoryServicesCOMException(ox8007202B): A referral was returned from >> > the >> > server. >> > >> > The error occurs at >> > "foreach (DirectoryEntry child in deContexts.Children)" >> > >> > >> > Can someone see what I need to corret here? Thanks. >> > --------------------------------------------------- >> > public void InitTree(string domainName) >> > { >> > string newDomain = domainName; >> > >> > >> > //Obtain and lists all the contexts nodes >> > contextPath = "CN=Contexts,CN=Unity,CN=Symark,CN=Program >> > Data," >> > + newDomain; >> > globalPath = "CN=Global,CN=Unity,CN=Symark,CN=Program Data," >> > + newDomain; >> > defaultPath = "CN=Contexts, >> > CN=DEFAULTS,CN=Unity,CN=Symark,CN=Program Data," >> > + newDomain; >> > >> > try >> > { >> > deContexts.Path = "LDAP://" + contextPath; >> > string path = deContexts.Path; >> > } >> > catch (System.Exception e) >> > { >> > MessageBox.Show(e.ToString(), "PowerADvantage"); >> > return; >> > } >> > >> > this.ppTree.Nodes.Clear(); >> > this.ppTree.ImageList = unityImageList; >> > >> > // Set the TreeView control's default image and selected >> > image >> > indexes. >> > this.ppTree.ImageIndex = 0; >> > this.ppTree.SelectedImageIndex = 1; >> > >> > >> > TreeNode unityNode = new TreeNode("PowerADvantage >> > Administration", 5, 5); >> > unityNode.Name = "PowerADvantage Administration"; >> > this.ppTree.Nodes.Add(unityNode); >> > >> > >> > //Tag the 1st Tree Node >> > this.ppTree.Nodes[0].Tag = new TreeNodeInfo(deContexts.Path, >> > true); >> > int index = 0; >> > TreeNode tn = unityNode.Nodes.Add("domainRoot", "Contexts", >> > 6, >> > 6); >> > tn.Name = "Contexts"; >> > >> > tn.Tag = new TreeNodeInfo(deContexts.Path, true); >> > TreeNodeInfo nodeInfo = (TreeNodeInfo)tn.Tag; >> > //this.ppTree.SelectedNode = unityNode; >> > >> > //Populate the tree nodes >> > try >> > { >> > foreach (DirectoryEntry child in deContexts.Children) >> > { >> > string delimStr = "="; >> > char[] delimiter = delimStr.ToCharArray(); >> > string[] split = null; >> > split = child.Name.Split(delimiter, 2); >> > >> > index = tn.Nodes.Add(new >> > TreeNode(split[1].ToString(), >> > 0, 1)); >> > tn.Nodes[index].Tag = new TreeNodeInfo(child.Path, >> > false); >> > tn.Nodes[index].Name = split[1].ToString(); >> > >> > } >> > } >> > catch (System.Exception e) >> > { >> > MessageBox.Show(e.ToString(), "PowerADvantage"); >> > } >> > //Add the Reports node >> > TreeNode reportNode = new TreeNode("Reports", 8, 8); >> > TreeNode licensesNode = new TreeNode("Licenses", 10, 10); >> > >> > //TreeNode computerDetail = new TreeNode("Computers - >> > Detail", >> > 9, 9); >> > //TreeNode groupDetailDetail = new TreeNode("Groups - >> > Detail", >> > 9, 9); >> > //TreeNode userDetail = new TreeNode("Users - Detail", 9, >> > 9); >> > //TreeNode contextsDetail = new TreeNode("Contexts - >> > Detail", >> > 9, >> > 9); >> > >> > unityNode.Nodes.Add(reportNode); >> > //reportNode.Nodes.Add(computerDetail); >> > //reportNode.Nodes.Add(groupDetailDetail); >> > //reportNode.Nodes.Add(userDetail); >> > //reportNode.Nodes.Add(contextsDetail); >> > unityNode.Nodes.Add(licensesNode); >> > >> > curDomain = newDomain; >> > nodeInfo.isLoaded = true; >> > this.ppTree.ExpandAll(); >> > } >> > >> > -- >> > Thanks. >> >> >> Excellent, that's what I'll do. Thank you for all your help.
-- Show quoteHide quoteThanks. "Joe Kaplan" wrote: > Nope. I suggest you create a factory method of some sort that allows you to > do this and use a centralized mechanism for creating all of your > DirectoryEntry objects. This has worked well for me in the past. I have a > single piece of code in most of my projects that calls the DirectoryEntry > constructor. > > Joe K. > > -- > Joe Kaplan-MS MVP Directory Services Programming > Co-author of "The .NET Developer's Guide to Directory Services Programming" > http://www.directoryprogramming.net > -- > "Pucca" <Pu***@discussions.microsoft.com> wrote in message > news:C7AB5081-B0A3-403F-ACFE-DF616B192F8F@microsoft.com... > > Thanks Joe that worked out well. However I have to change all the codes > > that > > tries to create a new DirectoryEntry object with the new DNS AND the user > > name and password. Is there a place where I can change the default > > binding > > to the new domain? > > > > > > -- > > Thanks. > > > > > > "Joe Kaplan" wrote: > > > >> You need to add the DNS domain name of the domain you want to access to > >> the > >> ADsPath if the domain is different from the domain the current user is > >> in. > >> Serverless binding (like you are doing) will always go to the current > >> domain. > >> > >> Joe K. > >> > >> -- > >> Joe Kaplan-MS MVP Directory Services Programming > >> Co-author of "The .NET Developer's Guide to Directory Services > >> Programming" > >> http://www.directoryprogramming.net > >> -- > >> "Pucca" <Pu***@discussions.microsoft.com> wrote in message > >> news:E2C0C72B-F537-4251-AF4B-2DCB324A8049@microsoft.com... > >> > Hi, I'm able to get the Domain object using GetDomain . I want to > >> > rebuild > >> > my > >> > tree using this new domain so I pass in the new DNS. I update that in > >> > the > >> > DirectoryEntry object's path. But I'm getting the following error > >> > message: > >> > > >> > DirectoryServicesCOMException(ox8007202B): A referral was returned from > >> > the > >> > server. > >> > > >> > The error occurs at > >> > "foreach (DirectoryEntry child in deContexts.Children)" > >> > > >> > > >> > Can someone see what I need to corret here? Thanks. > >> > --------------------------------------------------- > >> > public void InitTree(string domainName) > >> > { > >> > string newDomain = domainName; > >> > > >> > > >> > //Obtain and lists all the contexts nodes > >> > contextPath = "CN=Contexts,CN=Unity,CN=Symark,CN=Program > >> > Data," > >> > + newDomain; > >> > globalPath = "CN=Global,CN=Unity,CN=Symark,CN=Program Data," > >> > + newDomain; > >> > defaultPath = "CN=Contexts, > >> > CN=DEFAULTS,CN=Unity,CN=Symark,CN=Program Data," > >> > + newDomain; > >> > > >> > try > >> > { > >> > deContexts.Path = "LDAP://" + contextPath; > >> > string path = deContexts.Path; > >> > } > >> > catch (System.Exception e) > >> > { > >> > MessageBox.Show(e.ToString(), "PowerADvantage"); > >> > return; > >> > } > >> > > >> > this.ppTree.Nodes.Clear(); > >> > this.ppTree.ImageList = unityImageList; > >> > > >> > // Set the TreeView control's default image and selected > >> > image > >> > indexes. > >> > this.ppTree.ImageIndex = 0; > >> > this.ppTree.SelectedImageIndex = 1; > >> > > >> > > >> > TreeNode unityNode = new TreeNode("PowerADvantage > >> > Administration", 5, 5); > >> > unityNode.Name = "PowerADvantage Administration"; > >> > this.ppTree.Nodes.Add(unityNode); > >> > > >> > > >> > //Tag the 1st Tree Node > >> > this.ppTree.Nodes[0].Tag = new TreeNodeInfo(deContexts.Path, > >> > true); > >> > int index = 0; > >> > TreeNode tn = unityNode.Nodes.Add("domainRoot", "Contexts", > >> > 6, > >> > 6); > >> > tn.Name = "Contexts"; > >> > > >> > tn.Tag = new TreeNodeInfo(deContexts.Path, true); > >> > TreeNodeInfo nodeInfo = (TreeNodeInfo)tn.Tag; > >> > //this.ppTree.SelectedNode = unityNode; > >> > > >> > //Populate the tree nodes > >> > try > >> > { > >> > foreach (DirectoryEntry child in deContexts.Children) > >> > { > >> > string delimStr = "="; > >> > char[] delimiter = delimStr.ToCharArray(); > >> > string[] split = null; > >> > split = child.Name.Split(delimiter, 2); > >> > > >> > index = tn.Nodes.Add(new > >> > TreeNode(split[1].ToString(), > >> > 0, 1)); > >> > tn.Nodes[index].Tag = new TreeNodeInfo(child.Path, > >> > false); > >> > tn.Nodes[index].Name = split[1].ToString(); > >> > > >> > } > >> > } > >> > catch (System.Exception e) > >> > { > >> > MessageBox.Show(e.ToString(), "PowerADvantage"); > >> > } > >> > //Add the Reports node > >> > TreeNode reportNode = new TreeNode("Reports", 8, 8); > >> > TreeNode licensesNode = new TreeNode("Licenses", 10, 10); > >> > > >> > //TreeNode computerDetail = new TreeNode("Computers - > >> > Detail", > >> > 9, 9); > >> > //TreeNode groupDetailDetail = new TreeNode("Groups - > >> > Detail", > >> > 9, 9); > >> > //TreeNode userDetail = new TreeNode("Users - Detail", 9, > >> > 9); > >> > //TreeNode contextsDetail = new TreeNode("Contexts - > >> > Detail", > >> > 9, > >> > 9); > >> > > >> > unityNode.Nodes.Add(reportNode); > >> > //reportNode.Nodes.Add(computerDetail); > >> > //reportNode.Nodes.Add(groupDetailDetail); > >> > //reportNode.Nodes.Add(userDetail); > >> > //reportNode.Nodes.Add(contextsDetail); > >> > unityNode.Nodes.Add(licensesNode); > >> > > >> > curDomain = newDomain; > >> > nodeInfo.isLoaded = true; > >> > this.ppTree.ExpandAll(); > >> > } > >> > > >> > -- > >> > Thanks. > >> > >> > >> > > >
accessing emails using owa ... traceable?
Unhandled exception vs handled (security issue) Kerberos Token Renewal Login error when opening a deployed project Forms Authentication with Active Directory, login control crashes Impersonation testing User creation.... Is there a function that I can call to validate a domain? Security Exception Is all .NET assembles are vulnerable to decompilation ? |
|||||||||||||||||||||||