Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
    • Overview
    • Installation & Deployement
    • EO.Web ToolTip
    • EO.Web Rating
    • EO.Web Slider & RangeSlider
    • EO.Web ListBox
    • EO.Web ComboBox
    • EO.Web Captcha
    • EO.Web ASPX To PDF
    • EO.Web Slide
    • EO.Web Flyout
    • EO.Web EditableLabel
    • EO.Web ImageZoom
    • EO.Web Floater
    • EO.Web Downloader
    • EO.Web ColorPicker
    • EO.Web HTML Editor
    • EO.Web File Explorer
    • EO.Web SpellChecker
    • EO.Web Grid
    • EO.Web MaskedEdit
    • EO.Web Splitter
    • EO.Web Menu
    • EO.Web Slide Menu
    • EO.Web TabStrip
    • EO.Web TreeView
    • EO.Web Calendar
    • EO.Web Callback
    • EO.Web MultiPage
    • EO.Web Dialog
    • EO.Web AJAXUploader
    • EO.Web ProgressBar - Free!
    • EO.Web ToolBar - Free!
  • EO.WebBrowser
  • EO.Wpf
  • Common Topics
  • Reference
Accessing External Files

Overview

EO FileExplorer can be used to access external files that are outside of your application root. For example, even if your Web application root is set to "c:\wwwroot\WebApp1", you can still set the FileExplorer's RootFolder to "c:\" and allow users to browse the whole system drive.

Note: Extra precaution must be taken when you expose files/directories outside of your application root through Web.

To use this feature, simply set RootFolder to anywhere your application has access to. You may need to check Windows NT file system permission to make sure your Web application has enough permission to access the files. In case your Web application does not have sufficient permission to access files outside of your application root, FileExplorer will not be able to access those files either.

Use external path mappings

When FileExplorer is used to access files that are outside of the application root, end user is able to browse the files, but they will not be able to access the file contents directly because the file is outside of the application root, thus a direct Url to that file does not exist.

In order for the file to be accessible to the user (for example, in order for user to view an image file), a direct Url to that file must exist. FileExplorer allows you to provide additional path mapping information to map a physical file to a Url. The Url can point to a site that is different than your main site.

The following sample demonstrates this feature. The server is configured to host two websites: www.site1.com with root directory "c:\wwwroot\site1" and www.site2.com with root directory "c:\wwwroot\site2". FileExplorer runs on www.site1.com.

In order for the FileExplorer to access files on site2, the RootFolder property is configured to point to www.site2.com's root directory:

ASPX
<eo:FileExplorer RootFolder="c:\wwwroot\site2">
.....
</eo:FileExplorer>

In order for user to be able to access the files, FileExplorer is configured to include one PathMapping object:

ASPX
<eo:FileExplorer RootFolder="c:\wwwroot\site2">
    <PathMappings>
        <eo:PathMapping DisplayName="Site2 Files" Path="c:\wwwroot\site2" Url="http://www.site2.com" />
    </PathMappings>
</eo:FileExplorer>

The PathMapping object instructs the FileExplorer to translate any physical path starts with "c:\wwwroot\site2" into a Url starting with "http://www.site2.com". For example, if user selects file "c:\wwwroot\site2\image.gif", the FileExplorer's SelectedFile property would return "http://www.site2.com/image.gif". Your application can then use this Url directly because it is accessible by the end user. Without the PathMapping object, it would return "c:\wwwroot\site2\image.gif". This path can be used by your server side code to access the file but it can not be used by the end user to access the file.

Change root folder display names

PathMapping object can also be used to change the display name for the root folder. In the previous sample, DisplayName is set to "Site2 Files". As a result, FileExplorer displays "Site2 Files" instead of "c:\wwwroot\site2" as its root node.