Note that there are some explanatory texts on larger screens.

plurals
  1. POWeird behaviour in IIS 7.0 - System.DirectoryServices
    text
    copied!<p>I am facing a weird issue in IIS 7.0:</p> <p>I have the following virtual directory in IIS: <a href="http://i39.tinypic.com/4iijbb.jpg" rel="nofollow noreferrer">alt text http://i39.tinypic.com/4iijbb.jpg</a></p> <p><b>and only Windows Authentication mode is enabled on the virtual directory in IIS</b></p> <p>Now if I try to get associated DirectoryEntry for TestV/Folder/file.aspx in this manner:</p> <pre><code>string vDir = @"/TestV/folder/file.aspx"; DirectoryEntry dir = new DirectoryEntry("IIS://" + serverName + "/W3SVC/1/ROOT" + vDir, @"adminusername", @"password"); dir.AuthenticationType = AuthenticationTypes.Secure; try { Console.WriteLine(dir.Name); } catch (Exception exp) { Console.WriteLine(exp.Message); } Console.WriteLine(""); </code></pre> <p>I get the exception: "The system cannot find the path specified"</p> <p>Now if I go back to IIS and then perform the following steps: Right click on TestV/Folder <i>and enable Anonymous authentication mode and then disable it again</i></p> <p>Right click on TestV/Folder/file.aspx <i>and enable Anonymous authentication mode and then disable it again</i></p> <p>Essentially i just performed some manual access on the aspx file Testv/Folder/file.aspx.</p> <p>After the above steps if i re run the program, the code is successfully able to access the directory entry and successfully prints the name (file.aspx)</p> <p>What is the problem here?</p> <p>One more information:</p> <p>I see this behavior on IIS 6.0 also. So it appears like until and unless I do some manual operation in IIS for a folder/file in virtual directory, it does not create the corresponding metadata in the active directory?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload