本文整理汇总了C#中DirectoryEntry.CommitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryEntry.CommitChanges方法的具体用法?C# DirectoryEntry.CommitChanges怎么用?C# DirectoryEntry.CommitChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DirectoryEntry
的用法示例。
在下文中一共展示了DirectoryEntry.CommitChanges方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWebSite2
private void CreateWebSite2(string websname, string webpath)
{
try
{
string installPath = webpath;
string IISVirtualDirectory = websname;
var root = new DirectoryEntry("IIS://localhost/W3SVC/1/ROOT");
foreach (DirectoryEntry directoryEntry in root.Children)
{
if (directoryEntry.Name == IISVirtualDirectory)
{
try
{
root.Invoke("Delete", new[] { directoryEntry.SchemaClassName, IISVirtualDirectory });
root.CommitChanges();
}
catch (Exception) { }
}
}
DirectoryEntry de = root.Children.Add(IISVirtualDirectory, "IIsWebVirtualDir");
de.Properties["Path"][0] = installPath;
de.Invoke("AppCreate", true);
de.Properties["AppFriendlyName"][0] = IISVirtualDirectory;
//de.Properties["ScriptMaps"].Value = AddScriptArray();
//IIS下,将Framework自动对应到2.0版本。
Object[] mappings = (Object[])de.InvokeGet("ScriptMaps");
StringBuilder sb = new StringBuilder();
foreach (var a in mappings)
{ sb.Append(a + "\r\n"); }
ArrayList list = AddScriptArray();
de.CommitChanges();
}
catch { }
}
示例2: RemoveAllMembers
// Summary:
// Removes all members belonging to this GroupPrincipalFull
//
// Returns:
// void
//
// Exceptions:
//
public void RemoveAllMembers()
{
var groupDe = new DirectoryEntry(string.Format("LDAP://{0}", DistinguishedName));
groupDe.Properties["member"].Clear();
groupDe.CommitChanges();
groupDe.Close();
}
示例3: RemoveMember
// Summary:
// Removes the distinguished name of the supplied Principal object from the member attribute belonging to this GroupPrincipalFull
//
// Returns:
// void
//
// Exceptions:
//
public void RemoveMember(Principal principal)
{
var groupDe = new DirectoryEntry(string.Format("LDAP://{0}", DistinguishedName));
groupDe.Properties["member"].Remove(principal.DistinguishedName);
groupDe.CommitChanges();
groupDe.Close();
}
示例4: UpdateDirInfo
//更新东东
private void UpdateDirInfo(DirectoryEntry de, VirtualDirectory vd)
{
de.Properties["AnonymousUserName"][0] = vd.AnonymousUserName;
de.Properties["AnonymousUserPass"][0] = vd.AnonymousUserPass;
de.Properties["AccessRead"][0] = vd.AccessRead;
de.Properties["AccessExecute"][0] = vd.AccessExecute;
de.Properties["AccessWrite"][0] = vd.AccessWrite;
de.Properties["AuthBasic"][0] = vd.AuthBasic;
de.Properties["AuthNTLM"][0] = vd.AuthNTLM;
de.Properties["ContentIndexed"][0] = vd.ContentIndexed;
de.Properties["EnableDefaultDoc"][0] = vd.EnableDefaultDoc;
de.Properties["EnableDirBrowsing"][0] = vd.EnableDirBrowsing;
de.Properties["AccessSSL"][0] = vd.AccessSSL;
de.Properties["AccessScript"][0] = vd.AccessScript;
de.Properties["DefaultDoc"][0] = vd.DefaultDoc;
de.Properties["Path"][0] = vd.Path;
de.CommitChanges();
}