Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Giving ASPNET permission to change IIS Settings

Status
Not open for further replies.

logicalunatic

Programmer
Jan 19, 2004
84
US
Hello,

**Also posted in ASP.net forum**

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top