IIS problem with search directory in virtual directory

I have two different mappings of virtual directories to the same directory in the OS. In one of these virtual directories, I need to disable browse folders, and in the other, I need to enable it.

The problem is that when I changed one of them, the other changed. I think this issue is because both virtual directories point to the same folder in the OS, but with IIS6 I had the same configuration with a problem.

Any idea for working with this?

Thanks!

+2


a source to share


3 answers


IIS 7 does use a web.config file in directories for configuration, however you can also opt out of using the web.config file (i.e. not use the IIS Manager tool) and instead of enabling directory browsing through IIS Manager, just edit the applicationHost.config application to set up directory browsing in the one and only virtual directory where you actually want browsing enabled. This will allow you to browse in one virtual directory but not the other, even if both point to the same physical directory.

Here's an example: Edit the applicationHost.config file. This file can be found in the % WINDIR% \ System32 \ inetsrv \ config directory .

1) Go to the bottom of the file. You should find the XML closing tag for the config section:

</configuration>

      

2) above this tag, add a location tag using the following as a guide:



 <location path="{website name}/{path to virtual directory}">
      <system.webServer>
           <directoryBrowse enabled="true" />
      </system.webServer>
 </location>

      

Replace {web site name} with the web site name (as shown in IIS Manager) for the web site in question and {virtual directory path} with the path to the virtual directory you want to view. Example:

<location path="MyWebsite/imagelist">

      

Now, say in the above example, imagelist is a virtual directory that points to {your webroot} / pics, and you have another virtual directory called images that also points to {your webroot} / pics. When a visitor goes to yoursite.com/images , they won't see the list of images, but when they go to yoursite.com/imagelist , they will return the returned directory.

+4


a source


There are many possibilities, but what I ran into and fixed it like below.

  • The .NET framework in IIS does not match the one specified in the web.config. Change the structure in IIS to one of the projects. (if the project or solution is built 4.5 / 4.0 then change IIS to 4.0 according to your website settings.)

  • Check that the tags in the web.config are properly closed for all nodes.



This should work!

Thank you, Anand

+1


a source


The reason this behavior differs from IIS6 is that IIS6 has retained a property to allow directory browsing in IIS6 Metabase DirBrowseFlags virtual directory property, which has a unique entry for each virtual directory, whereas in IIS7 this property is now stored only in the fileWeb.config

:

<system.webServer>
    <!-- ... -->
    <directoryBrowse enabled="true" />
</system.webServer>

      

Since your virtual directories in IIS7 have the same physical directory, they both have the same file Web.config

, and so you will find that changing a property in one causes the change to appear in the other, both change the same file Web.config

...

(I don't know if this is good for IIS7 for you at the moment.)

0


a source







All Articles