How to access remote files?

Introduction

When developing templates for your company using Ecrion products, you will most probably need to use Paths to reference your files. This article aims to provide information about:

  • Relative and absolute/full paths;
  • UNC Paths and when to use them?

How to

A. Absolute paths:

Absolute or full paths point to the same location in a file system, regardless of the current working directory. This usually begins with a drive letter followed by a colon, such as C:

Example of full path: C:\Users\{username}\{my_directory}\{my_file}

B. Relative paths:

By contrast, a relative path contains only that part of the absolute path that needs to be traced from the current directory. The missing part will be automatically populated with the absolute path of the current directory. Relative paths use dot and double-dots (. and ..) notation. Example of relative paths : 

..\{my_file}

..\{my_directory}\{my_file}

Considering that relative paths cannot reference data on other disk drives, and absolute paths work best when the files aren't moved from your personal computer, what happens when the files are located on a remote server? What should you use then? 

C. UNC Paths:

As indicated by the Microsoft article below, "a service that must access a remote resource should use the Universal Naming Convention (UNC) name to access the resource". So, when you need to use files like subdocuments, images, etc. located on another server, in your local templates, you may need to use full UNC Paths. 

The format for a UNC Path is: \<ServerName><ShareD Folder Name><SubdocumentFile>

Notes:

  • The map drives are visible only to current logged-in user. The XF Rendering Engine runs under system user. Considering this, you need to ensure that the user under which the XFR Service runs has access to that UNC Path. 
  • Under the UNC Path, you cannot include a drive letter (such as F).

Example:

Let's assume that your company environment looks like this:

  • Local computer. On the local computer you have:
    • The Ecrion server installed;
    • The main template;
  • Another server, let's say <Server_S10>. On this server, the following files can be found(all included in a shared folder called Resources):
    • Subdocuments;
    • Logos;
    • Stylesheet.

To access the files located in Server_S10 from the local computer, you need to use network paths (UNC paths) in your main template, like below:

a) To reach a subdocument: \\Server_S10\Resources\Subdocuments\my_subdocument.epb;

b) To reach an image: \\Server_S10\Resources\Logos\logo.png;

c) To reach a stylesheet: \\Server_S10\Resources\CSS\my_style.css;

For more information, please follow the link below:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms685143(v=vs.85).aspx

Have more questions? Submit a request

Comments

Powered by Zendesk