locked
Access to IIS 6.0 with debugging but Access denied with compiled file RRS feed

  • Question

  • User-1668256174 posted

    Hello everybody,

    I want to access IIS 6.1 on Windows 7 to retrieve the physical path of an url.

    The code below is working fine in debugging mode with Visual Studio 2013.

    But it fails when I run the compiled file : the error is "Access denied".

    Here is my code :

    using System.DirectoryServices;

    string _sIIS_Localhost = "IIS://localhost/W3SVC/1/Root/"; string sIIS_Path = sUrlPath.Replace(@"http://localhost/", _sIIS_Localhost); sIIS_Path = sIIS_Path.TrimEnd('/'); using (DirectoryEntry de = new DirectoryEntry(sIIS_Path)) { //Fails here : return de.Properties["Path"].Value.ToString(); }

    Are there 2 different user accounts ?

    Thank you very much in advance.

    Eric.

    Tuesday, May 23, 2017 2:46 PM

All replies