WebDAV Website Importer for WebMatrix
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:
WebMatrix 2 Splash Screen |
WebMatrix 2 Quick Start Screen |
Editing QDIG in WebMatrix 2 |
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:
- What this extension actually does.
- How to install this extension.
- How to use this extension.
What the WebDAV Website Importer Extension Actually Does
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.)
How to Install the WebDAV Website Importer Extension
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.
WebMatrix 2's Extensions Menu |
When the Extensions Gallery appears, you will see the WebDAV Website Importer in the list of extensions.
WebDAV Website Importer in the Extensions List |
When you click Install, the WebDAV Website Importer details page will be displayed.
WebDAV Website Importer Details |
When you click Install, the End User License Agreement for the WebDAV Website Importer will be displayed.
WebDAV Website Importer EULA |
When you click I Accept, WebMatrix will download and install the extension.
How to Use the WebDAV Website Importer 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.
Import Site from WebDAV menu |
When you click Import Site from WebDAV, WebMatrix will prompt you for the credentials to your WebDAV website.
WebDAV Website Credentials Dialog |
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.
Summary
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.
Comments
- Anonymous
July 17, 2015
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. Parameter name: length 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)