Opening Docs from a WebDAV Server with Cookies Authentication

The functionality described in this article is available in IT Hit Ajax File Browser v4 Beta and later versions.

Using Edit Document Opener protocol application provided with Ajax File Browser you can open documents for editing from a WebDAV server that supports cookies authentication. A required persistent cookie(s) from a web browser will be passed to WebDAV client, so the login dialog is not displayed. The protocol app can pass persistent cookies from Chrome, Firefox, Safari, Edge and Internet Explorer on Windows, OS X and several Linux flavors.

Both Edit Document Opener protocol applications provided with Ajax File Browser v3 and and v4 can be installed side by side on one machine and run without interfering.

To create a WebDAV server with pure cookies authentication you can add WebDAV support to your ASP.NET website using 'Add WebDAV Server Implementation...' wizard selecting "Cookies/Forms" option and leaving Basic, Digest and MS-OFBA options unchecked.

To pass cookies from web browser to WebDAV client app add the EditDocAuth section when creating Ajax File Browser:

var settings = {
    BasePath: '/',
    EditDocAuth: {
        Authentication: 'cookies',                // Authentication to use when opening docs: 'challenge', 'cookies'
        SearchIn: 'current',                      // Web browsers to search for permanent cookies: 'сurrent', 'none', 'all'.
        CookieNames: '.AspNet.ApplicationCookie', // Coma separated list of cookie names to search for.
        LoginUrl: '/Account/Login/'               // Login URL to redirect if any cookie specified in CookieNames param is not found.

If the Authentication param is set to 'cookies', the Ajax File Browser will always use the protocol application to open all types of documents, including MS Office documents. No log-in dialogs will be displayed when opening documents, it is expected that the authentication cookie will be found and passed to the WebDAV client, so the log-in dialog is not required. Note that protocol handlers installed by MS Office does NOT support cookies authentication, you must install the IT Hit Edit Document Opener to use cookies auth.

The SearchIn parameter tells the Ajax File Browser to find and transfer cookies specified in CookieNames parameter to WebDAV client application (MS Office, Microsoft Mini-refirector, OS X, Finder, etc). It can search a current web browser or all installed web browsers.

In the CookieNames parameter you will specify a list of cookies to be transferred to WebDAV client. This is typically an authentication cookie, it is different for every type of server. For example the ASP.NET web application usually use cookie called .AspNet.ApplicationCookie, the Java servlet container often uses JSESSIONID cookie name. Check your server documentation to find the authentication cookie name. You can also use tools like Fiddler or web browser debugging and development tools to find the name of the authentication cookie.

Important! The cookie(s) specified in CookieNames parameter must be persistent (has an expiration date), the protocol app can not pass the non-persistent cookies.

If the protocol application did not find any the cookie specified in CookieNames parameter and the LoginUrl parameter is specified, it will show message offering a user to navigate to the login page and log-in with the "keep me loged-in" checkbox:

If cookie is not found the ptrotocol app will show message offering to navigate to the login page and check the "keep me loged-in" checkbox.

Next Article:

Do I Need to Install davX: Protocol on a Client Machine to Open Documents?