HomeASP.NET Return Property Value using .NET System.Di...
Return Property Value using .NET System.DirectoryServices Namespace
This one value isn't always populated in every top-level domain on an IISserver. It is inherited from the top W3SVC setting and if it's been setfor an individual top-level domain this LogFileDirectory property will be setotherwis ...
This one value isn't always populated in every top-level domain on an IISserver. It is inherited from the top W3SVC setting and if it's been setfor an individual top-level domain this LogFileDirectory property will be setotherwise won't exist. In order for this code to work, the accountrunning on the local or remote machine needs administrator privilages
using System;
using System.DirectoryServices;
//our custom namespace
namespace myNamespace
{
//our custom class
public class domain
{
public domain(string logpath)
{
logPath = logpath;
}
//some member variables
private string logPath;
public string LogPath
{
get {return logPath;}
set {logPath=value;}
}
public string C(string domainName, string logPath)
{
string strPath = "IIS://TopLevelDomainName/" + logPath;
System.DirectoryServices.DirectoryEntry ds = new DirectoryEntry(strPath);
object s = ds.Properties["LogFileDirectory"].Value;
return s.ToString();
}
}
}