Hi,
I am using .NET Framework 4.0 in that i have created one windows application to get the Active directory details
i have used appconfig file to give the configuration of machine
when i try to fetch the details from Active directory it gives the user list when it was connected to network but when unplug my system from network it's not working it raise the Directory Entry.Guid File not found exception but in network connection it get success
please help me to solve this issue
my appconfig file
<configSections>
<sectionGroup name="Servers" type="System.Configuration.ConfigurationSectionGroup" >
<section name="server1" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</configSections>
<Servers>
<server1>
<add key="connectionstring" value="Data Source=datasource;Initial Catalog=database;User ID=xx;Password=password"/>
<add key="entrypath" value="WinNT://domain/systemname"/>
<add key="Username" value="domain\username"/>
<add key="password" value="password"/>
</server1>
foreach (ConfigurationSection config_section in section.Sections)
{
try
{
var servers = ConfigurationManager.GetSection(config_section.SectionInformation.SectionName) as NameValueCollection;
connection_string = servers["connectionstring"].ToString();
string Entrypath = servers["entrypath"].ToString();
string username = servers["Username"].ToString();
string password = servers["password"].ToString();
password = oVWSec.DecryptData(password);
DirectoryEntry entryPC = new System.DirectoryServices.DirectoryEntry(Entrypath, username, password);
try
{
debug_string.WriteLine("Connect to Server: " + Entrypath);
WriteLog("Connect to Server: " + Entrypath);
foreach (System.DirectoryServices.DirectoryEntry child in entryPC.Children)
{
}
}
it raise the error in entryPC.Children
in the following line
foreach (System.DirectoryServices.DirectoryEntry child in entryPC.Children)
help me to solve this