In this article, we will look into one of the feature of IIS 7.5 that helps to publish\edit web site contents like code files, images etc. over HTTP or HTTPS on the fly. It is an extension of HTTP 1.1 and no need to open any additional port for publishing the content and it provides file locking mechanism to ensure only one user can modify a file at a time.
Let’s open IIS 7.5 manager and check whether WebDAV module present or not under IIS section as shown below:
If it not exists, we can install same by going “Turn on or off Windows Feature” in Control Panel and selecting same under Internet Information Services, WWW Services, Common HTTP Features, then WebDAV Publishing.
Let’s select “Default Web Site”, double-click on “WebDAV Authoring Rules” and understand its settings:
Click on “Enable WebDAV” to enable it on Default Web Site, then click on “Add Authoring rule” to add a new authoring rule:
Here, we allowed access to all files within web site for all users with permission to READ, WRITE and SOURCE on it.
Now, enable Windows Authentication on Default Web Site for WebDAV or we can use Basic Authentication over HTTPS as well.
Add a new authorization rule to allow access to all users.
We configured WebDAV on IIS and let’s map to drive and browse it content.
By using net use command, we mapped WebDAV to Y: drive. Now, we can directly edit its content and same will be reflected on IIS.
Instead of IIS Manager, we can use appcmd.exe to configure it with the following command:
C:\Windows\System32\inetsrv>appcmd.exe set config "Default Web Site" -section:sy
stem.webServer/webdav/authoringRules /+"[roles='Guests',path='*',access='Read, W
rite']" /commit:apphost
This command will add new authoring rule to provide full access on all file content to Guests role.
Please ensure to use option /Commit:apphost to commit changes to correct location section in IIS configuration file [ApplicationHost.config].
We can use “WebDAV Settings” in Actions pane to set common WebDAV settings like Request filtering configuration[like file extension restriction] will apply to WebDAV or not, to list hidden files or not, is SSL required [only HTTPS], etc.
This feature remained same in IIS 8, 8.5 and above settings will still apply. This feature is very helpful to publish\edit web site content onto IIS remotely. It is flexible than FTP, more secure, runs on HTTP, allows only one user to modify a file at a time and no need to open additional ports [default:21] for FTP communication.
I am ending the things here on WebDAV, I hope this article will be helpful for all.
Read more articles on IIS