logicalunatic
Programmer
Hello,
I'm working on a solution that will allow users to add hostnames to their IIS website online. I've got it all working except for when the changes to IIS must be saved using the DirectoryEntry.CommitChanges() method...
Every time I try this I get the Access Denied error.
I've tried specifying the user account like so...
And also tried setting the user in the web.config file...
I've also tried using identity without specifying the userName or password and entering that as the page loads with the exact same result.
If anybody has an idea as to how I should get this working it would be much appreciated.
Thanks!
LogicaLunatic
I'm working on a solution that will allow users to add hostnames to their IIS website online. I've got it all working except for when the changes to IIS must be saved using the DirectoryEntry.CommitChanges() method...
Code:
System.DirectoryServices.DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC/959245610");
root.Properties["ServerBindings"].Add("192.168.0.182:80:[URL unfurl="true"]www.website.com");[/URL]
root.CommitChanges();
Every time I try this I get the Access Denied error.
I've tried specifying the user account like so...
Code:
System.DirectoryServices.DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC/959245610","UserID",
"Password");
root.Properties["ServerBindings"].Add("192.168.0.182:80:[URL unfurl="true"]www.website.com");[/URL]
root.CommitChanges();
And also tried setting the user in the web.config file...
Code:
<identity impersonate="true" userName="username" password="password" />
I've also tried using identity without specifying the userName or password and entering that as the page loads with the exact same result.
If anybody has an idea as to how I should get this working it would be much appreciated.
Thanks!
LogicaLunatic