The other day I was talking with one of my coworkers, Yishai Galatzer, about Microsoft's WebMatrix. By way of introduction, Yishai is one of our senior developers on the WebMatrix project; I'm not sure if you've used WebMatrix, but it's a pretty handy website editor. Here's a few generic screen shots:
In any event, I was explaining how easy it is to work with WebDAV, and I mentioned that I had written some some blogs about working with WebDAV websites programmatically. (See my Sending WebDAV Requests in .NET Revisited blog for an example.) Since WebMatrix 2 has some pretty cool extensibility, Yishai challenged me to write a WebDAV extension for WebMatrix. His idea was just too good for me to pass up, so I stayed up late that night and I wrote a simple WebDAV Website Import extension for WebMatrix 2.
With that in mind, there are a few things that I need to explain in this blog:
The WebDAV Website Importer extension does just what its name implies - it allows you to import a website into WebMatrix over WebDAV. This allows you to download your website to your local computer, where you can make changes to your source files and test them on your local system with IIS Express.
It should be noted that this extension is only designed to create a new local website by downloading a copy of your website's files in order to create a local copy of your website - it is not designed to be a website publishing feature like WebMatrix's built-in FTP and Web Deploy features. (I would like to write a full-featured website import/export/sync extension, but that's another project for another day.)
To install this extension, you first need to install WebMatrix. You can find details about installing WebMatrix at the following URL:
Once you have WebMatrix installed, click the Extensions menu on the ribbon, and then click Gallery.
When the Extensions Gallery appears, you will see the WebDAV Website Importer in the list of extensions.
When you click Install, the WebDAV Website Importer details page will be displayed.
When you click Install, the End User License Agreement for the WebDAV Website Importer will be displayed.
When you click I Accept, WebMatrix will download and install the extension.
Once you have downloaded and installed the WebDAV Website Importer extension, it will show up whenever you are creating a new website in WebMatrix.
When you click Import Site from WebDAV, WebMatrix will prompt you for the credentials to your WebDAV website.
Once you enter your credentials and click OK, the extension will import the content from your WebDAV website and save it in a new local website folder.
So - there you have it; this is a pretty simple extension, but it opens up some WebDAV possibilities for WebMatrix. As I mentioned earlier, this extension is import-only - perhaps I'll write a full-featured import/export/sync extension in the future, but for now - this was a cool test for combining WebMatrix extensibility and WebDAV.
I get the following error when attempting to import an oracle service now webdav customer portal.
Index and length must refer to a location within the string.
Parameter name: length
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
at System.String.Substring(Int32 startIndex, Int32 length)
at WebMatrixWebDavImportExtension.ImportSiteFromWebDAV.GetFolderContents(String szChildRequestURL, String szUID, String szPWD, String szDOM)
at WebMatrixWebDavImportExtension.ImportSiteFromWebDAV.CreateSiteImpl(DirectoryInfo myWebSitesFolder, DirectoryInfo& webSiteFolder)