WebDAV File System <fileSystem>

Overview

The <fileSystem> element of the <authoring> element specifies how the WebDAV module interacts with the underlying file system. More specifically, the <fileSystem> element contains attributes that define whether file operations should be transactional, and whether hidden files or virtual directories will be returned in property requests, which are commonly used for directory listings.

Compatibility

Version Notes
IIS 7.5 The <fileSystem> element of the <authoring> element ships as a feature of IIS 7.5.
IIS 7.0 The <fileSystem> element of the <authoring> element was introduced in WebDAV 7.0, which was a separate download for IIS 7.0.
IIS 6.0 N/A

Note: The WebDAV 7.0 and WebDAV 7.5 modules shipped out-of-band for IIS 7.0, which required downloading and installing the modules from the following URL:

http://www.iis.net/expand/WebDAV

With Windows 7 and Windows Server 2008 R2, the WebDAV 7.5 module ships as a feature for IIS 7.5, so downloading WebDAV is no longer necessary.

Setup

To support WebDAV publishing for your Web server, you must install the WebDAV module. To do so, use the following steps.

IIS 7.5 for Windows Server 2008 R2

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
  4. On the Select Role Services page of the Add Role Services Wizard, expand Common HTTP Features, select WebDAV Publishing, and then click Next.
  5. On the Confirm Installation Selections page, click Install.
  6. On the Results page, click Close.

IIS 7.5 for Windows 7

  1. On the taskbar, click Start, and then click Control Panel.
  2. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off.
  3. Expand Internet Information Services, then World Wide Web Services, and then Common HTTP Features.
  4. Select WebDAV Publishing, and then click OK.

IIS 7.0 for Windows Server 2008 and Windows Vista

How To

How to allow hidden files to be listed in WebDAV responses

  1. Open Internet Information Services (IIS) Manager:
    • If you are using Windows Server 2008 or Windows Server 2008 R2:
      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:
      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, expand the server name, and then go to the site, application, or directory where you want to enable WebDAV publishing.
  3. In the Home pane, double-click WebDAV Authoring Rules.
  4. In the Actions pane, click WebDAV Settings...
  5. In the WebDAV Settings pane, choose select True for Allow Hidden Files to be Listed if you want properties for hidden files to be returned in property responses; otherwise, choose False.
  6. Click Apply in the Actions pane.

Configuration

The <fileSystem> element is configurable only at the site level in the ApplicationHost.config file. Any <fileSystem> elements at other levels or in Web.config files are ignored.

Attributes

Attribute Description
allowHiddenFiles

Optional Boolean attribute.

true if WebDAV will display hidden files in the responses to property requests; otherwise, false.

Note: Even though files may be hidden from property requests, they can still be requested directly. For example, if you hid the Web.config file for your Web site, it would not be displayed in directory listings, but you could still open the file in a WebDAV-based editor if you knew that the path existed.

The default value is false.

useTransactionalIo

Optional Boolean attribute.

The useTransactionalIo attribute specifies whether file operations should be transactional. For example, transactional processing helps to define what a server's behavior should be if a client sends a MOVE request for a series of files and the destination runs out of storage space before the entire operation has completed. With transactional processing enabled, the entire operation should fail. When transactional processing is disabled, the operation will only partially succeed and files will be distributed between the source and destination.

When set to false, the WebDAV module will not enforce any form of transactional processing. When set to true, the WebDAV module will enforce transactional processing by failing the operation if the base file system cannot transactions.


The default value is false.

hideChildVirtualDirectories Optional Boolean attribute.

true if virtual directories are hidden from WebDAV requests; otherwise, false.

Note: This attribute was added in WebDAV 7.5 and IIS 7.5.

The default value is false.

Child Elements

None.

Configuration Sample

The following example lists a sample <webdav> element for the Default Web Site. This example clears any existing authoring rules, adds a single rule for the administrators group, enables WebDAV authoring, specifies that hidden files are allowed, enables WebDAV locks and specifies the lock provider, and enables WebDAV properties and specifies the default XML namespace for property mapping.

<location path="Default Web Site">
   <system.webServer>
      <webdav>
         <authoringRules defaultAccess="none" allowNonMimeMapFiles="true" defaultMimeType="text/plain">
            <clear />
            <add roles="administrators" path="*" access="Read, Write, Source" />
         </authoringRules>
         <authoring enabled="true" requireSsl="false">
            <fileSystem allowHiddenFiles="true" />
            <locks enabled="true" lockStore="webdav_simple_lock" requireLockForWriting="false" />
            <properties allowAnonymousPropfind="false" allowInfinitePropfindDepth="false" allowCustomProperties="true">
               <clear />
               <add xmlNamespace="*" propertyStore="webdav_simple_prop" />
            </properties>
         </authoring>
      </webdav>
   </system.webServer>
</location>

Sample Code

The following examples configure the WebDAV file system settings so that hidden files and virtual directories will be returned in property query responses.

AppCmd.exe

appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:"True" /fileSystem.hideChildVirtualDirectories:"True" /commit:apphost

Note: You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetApplicationHostConfiguration();
         ConfigurationSection authoringSection = config.GetSection("system.webServer/webdav/authoring", "Default Web Site");

         ConfigurationElement fileSystemElement = authoringSection.GetChildElement("fileSystem");
         fileSystemElement["allowHiddenFiles"] = true;
         fileSystemElement["hideChildVirtualDirectories"] = true;

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample
   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration
      Dim authoringSection As ConfigurationSection = config.GetSection("system.webServer/webdav/authoring", "Default Web Site")

      Dim fileSystemElement As ConfigurationElement = authoringSection.GetChildElement("fileSystem")
      fileSystemElement("allowHiddenFiles") = True
      fileSystemElement("hideChildVirtualDirectories") = True

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var authoringSection = adminManager.GetAdminSection("system.webServer/webdav/authoring", "MACHINE/WEBROOT/APPHOST/Default Web Site");
var fileSystemElement = authoringSection.ChildElements.Item("fileSystem");
fileSystemElement.Properties.Item("allowHiddenFiles").Value = true;
fileSystemElement.Properties.Item("hideChildVirtualDirectories").Value = true;

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set authoringSection = adminManager.GetAdminSection("system.webServer/webdav/authoring", "MACHINE/WEBROOT/APPHOST/Default Web Site")
Set fileSystemElement = authoringSection.ChildElements.Item("fileSystem")
fileSystemElement.Properties.Item("allowHiddenFiles").Value = True
fileSystemElement.Properties.Item("hideChildVirtualDirectories").Value = True

adminManager.CommitChanges()
Deprecated Elements