.NET Server

Upgrading Your Server Implementation to WebDAV Server Engine .NET v5

In this article

Upgrading Your Server Implementation to WebDAV Server Engine .NET v5

The major change made in WebDAV Server Engine v5 is its support of .NET Standard 1.6. It can run on a full .NET Framework 4.6+ or on .NET Core 1.0+ and is provided with .NET Core samples that run on Linux and OS X in addition to Windows. The dependencies from System.Web, Owin, HttpListener, etc, that are not present in .NET Standard, were moved out of WebDAV.Server.Engine.dll to separate packages.

Synchronous and Asynchronous interfaces

The WebDAV Server Engine v5 contains asynchronous interfaces only. The synchronous interfaces will be added during future updates.

Changes in Public Interfaces

The WebDAV Server Engine v5 contains minimum changes to public interfaces comparing to v4.x. The only changes are the following:

  • WebDAV Context constructors in DavContextBaseAsync class each moved to its own package. This is done to make ITHit.WebDAV.Server package independent of any classes that are not present in .NET Standard 1.6.
  • DavRequest.Headers property is now of type IDictionary<string, string>. The type that this property used before, System.Collections.Specialized.NameValueCollection, is not present in .NET Standard.
  • DavEngineAsync.OutputXmlFormatting is now of type bool. The type that this property used before, System.Xml.Formatting, is not present in .NET Standard.
  • PutUploadProgressAndResumeModule and PostUploadProgressModule are moved to ITHit.WebDAV.Server.Web package.

WebDAV Context Changes

Changes in WebDAV context is the major change that influences your existing code. Typically you will just reference package appropriate for your project and change the name of the base class.

Constructors for OWIN DavContextBaseAsync(IOwinContext), System.Web DavContextBaseAsync(HttpContext) and HttpListener DavContextBaseAsync(HttpListenerContext, HttpListenerPrefixCollection) projects were removed from DavContextBaseAsync class. This class now has a single constructor which you would not use directly in most cases. The above packages contain WebDAV contexts that are specific for environments in which you will run your server:

Project TypeWebDAV Context Constructor in v4.x / v3.xWebDAV Context Constructor in v5
ASP.NET Core-based project Not present DavContextCoreBaseAsync class in ITHit.WebDAV.Server.Core
WebListener-based project Not present DavContextWebListenerBaseAsync class in ITHit.WebDAV.Server.WebListener
OWIN-based project DavContextBaseAsync(IOwinContext) Moved to DavContextOwinBaseAsync class in ITHit.WebDAV.Server.Owin
Classic ASP.NET project that uses System.Web.HttpContext DavContextBaseAsync(System.Web.HttpContext) Moved to DavContextWebBaseAsync class in ITHit.WebDAV.Server.Web
HttpListener-based project DavContextBaseAsync(HttpListenerContext, HttpListenerPrefixCollection) Moved to DavContextHttpListenerBaseAsync class in ITHit.WebDAV.Server.HttpListener
Any other project type DavContextBaseAsync(DavRequest, DavResponse) Remains in ITHit.WebDAV.Server 

How to Migrate Your Code to the New Version

  1. Remove reference to ITHit.WebDAV.Server v4.X from your project.
  2. Add reference to the new ITHit.WebDAV.Server v5. You will typically reference it from NuGet package. Or you can also reference it from IT Hit WebDAV Server SDK installed on your machine, by default it is installed to C:\Program Files (x86)\IT Hit\WebDAV Server Engine\<version>\Server\bin\ folder. 
  3. Add reference to the appropriate WebDAV Context. See the table above for where to find a new WebDAV Context class for your project.
  4. Replace base class for WebDAV Context in your project. For example for classic ASP.NET project that uses System.Web.HttpContext replace: 

    This code is part of WebDAV Server File System sample provided with IT Hit WebDAV Server Engine for .NET

                                
                            

    This code is part of WebDAV Server File System sample provided with IT Hit WebDAV Server Engine for .NET

                                
                            

    with: 

    This code is part of WebDAV Server File System sample provided with IT Hit WebDAV Server Engine for .NET

                                
                            

    This code is part of WebDAV Server File System sample provided with IT Hit WebDAV Server Engine for .NET

                                
                            
  5. Refactor DavRequest.Headers calls.
  6. Refactor DavEngineAsync.OutputXmlFormatting calls.
  7. Add reference to ITHit.WebDAV.Server.Web package if you are using PutUploadProgressAndResumeModule and PostUploadProgressModule modules in web.config. Change ITHit.WebDAV.Server module name to ITHit.WebDAV.Server.Web in web.config XML, your code will now look like this:

    This code is part of WebDAV Server File System sample provided with IT Hit WebDAV Server Engine for .NET

                                
                            

Next Article:

Upgrading Your Server Implementation to WebDAV Server Engine .NET v4