Mobile WebDAV Server Sample for iOS & Android
This is a mobile WebDAV server sample that runs on iOS and Android on .NET Standard 2.0. It stores all data in iOS/Android file system extended attributes.
This sample provides access to the documents inside a mobile app folder. To see the documents a user opens a sample web page served by this server sample in a web browser on any machine in the local network. A user can open-edit-save documents right back to the device as well as a user can upload, download and manage documents using any WebDAV client.
- .NET Standard 2.0 Preview.
- To compile the sample for Android:
- Visual Studio 2017 Preview (2) v15.3.2 Preview 7.0 or later on Windows.
- To compile the sample for iOS:
- Visual Studio 2017 Preview (2) v15.3.2 Preview 7.0 or later on Windows
- AND Visual Studio 2017 for Mac on Beta channel with Xamarin Mac agent running.
Note that iOS project can not be compiled using Visual Studio 2017 for Mac only or Visual Studio 2017 Preview on Windows only. You will need Visual Studio BOTH on Mac OS X and on Windows!
Setting the License
To run the example, you will need a valid IT Hit WebDAV Server Engine License. You can download the license in the product download area. Note that the Engine is fully functional with a trial license and does not have any limitations. The trial license is valid for one month and the engine will stop working after this. You can check the expiration date inside the license file. Download the license file and specify it's content in License field under DavEngineOptions in appsettings.webdav.json file.
You can also run the sample without explicitly specifying a license for 5 days. In this case the Engine will automatically request the trial license from IT Hit website https://www.webdavsystem.com. Make sure it is accessible via firewalls, if any. After 5 days the Engine will stop working. To extend the trial period you will need to download a license in a product download area and specify it in appsettings.webdav.json
Running the Sample from Visual Studio
While running sample on Android is typically obvious, running on iOS requires more affords. Below we describe how to build and run the sample project for iOS.
- Install Visual Studio 2017 for Mac. Switch to Beta channel. Make sure you have all Visual Studio 2017 for Mac updates installed.
- Configure OS X to accept connections to Xamarin Mac Agent. Find more details here:
- Install Visual Studio 2017 Preview (2) or later on Windows machine. Make sure you have all Visual Studio 2017 Preview updates installed.
- Download solution from NuGet using following command:
> nuget install WebDAV.ServerYou can also find solution in samples on GitHub and in samples provided with IT Hit WebDAV Server Engine for .NET SDK in the download area.
- Open a solution in Visual Studio 2017 Preview (2) or later on Windows.
- Connect to Xamarin Mac Agent on OS X, see links above for more details.
- Set the iOS project as stat-up project in a project context menu if not set. Run the iOS project. Depending if you have iOS emulator or iPhone/iPad selected in Visual Studio the application will start and with WebDAV server running.Note! Your WebDAV server on your iOS device/emulator has an IP address of the Mac OS X machine. The port is specified in ListenerPrefix field in appsettings.webdav.json file (3335 by default).
- Open a web browser on any machine on the network and navigate to the WebDAV server. On OS X running the Xamarin Max Agent you can use localhost to access the server: http://localhost:3335. On any other machine on the network including on the one running VS 2017 Preview (2) on Windows, use the OS X machine IP address, for example: http://192.168.1.2:3335/
During first start the application creates a sample folders and files hierarchy in the application documents folder, under \App_Data\WebDAV\Storage\ folder, so you can browse and edit documents as well as upload, download and manage hierarchy with a WebDAV client. The sample web page provided with a project contains WebDAV Ajax Library, which is used to list documents and open documents for editing from a web page. The application creates log files in application documents folder, under \App_Data\WebDAV\Logs\.