Hiya,
I'm trying to create a new site on IIS 6.0 using ADSI and C# using the
following code:
DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + ServerName +
"/w3svc", Username, Password, AuthenticationTypes.Secure);
DirectoryEntries sites = W3SVC.Children;
DirectoryEntry newSite = sites.Add("1234","IIsWebServer"); //create
a new site
newSite.CommitChanges();
The user definitely has full admin priviledges, but I'm receiving the
following error:
System.UnauthorizedAccessException: Access is denied.
at System.DirectoryServices.Interop.IAds.SetInfo()
at System.DirectoryServices.DirectoryEntry.CommitChan ges()
at UIAdmin.ConfigIIS.CreateNewWebSite(String SiteName) in
c:\inetpub\wwwroot\uiadmin\classes\configiis.cs:li ne 69
Other ADSI code work fine i.e.:
DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + ServerName +
"/w3svc", Username, Password, AuthenticationTypes.Secure);
foreach (DirectoryEntry Site in W3SVC.Children)
{
if (Site.SchemaClassName == WebServerSchema)
strSiteList += Site.Name + " - " +
Site.Properties["ServerComment"].Value.ToString() + "<br>";
}
Any ideas?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!