FileManagerRootFolderLocation Property

Gets or sets the actual location of the root folder. This property is required and can not be omitted.

This property can be set to:

  • A plain string which contains a physical/virtual path
    (e.g. "c:\SomeFolder", "/SomeFolder", "~/SomeFolder").

    This is parsed as PhysicalLocation.

    Note that virtual paths can only be resolved in a web application
    and on Linux paths starting with "/" are physical paths and not virtual paths.

  • A Location instance created with one of the builtin location providers
    (e.g. PhysicalLocation, AzureBlobLocation, AmazonS3Location, ArchiveLocation).

    You can also override Location base class to implement your custom location provider.

  • A provider string which defines a specific location provider
    (e.g. "Type=Physical; Path=c:\SomeFolder").

Definition

Namespace: GleamTech.FileUltimate.AspNet.UI
Assembly: GleamTech.FileUltimate (in GleamTech.FileUltimate.dll) Version: 8.8.7
C#
public Location Location { get; set; }

Property Value

Location

Example

Setting root folder location in code:

C#
//Setting a physical path string:
//See below for other path string examples.
rootFolder.Location = @"c:\SomeFolder\RootFolder";

//Setting a virtual path string:
//See below for other path string examples.
rootFolder.Location = "~/App_Data/RootFolder";

//Setting a location provider instance:
//See below for other location provider examples (UNC Path, AmazonS3, AzureBlob etc.).
rootFolder.Location = new PhysicalLocation
{
    Path = @"c:\SomeFolder\RootFolder"
};

//Setting a provider string:
//See below for other provider string examples (UNC Path, AmazonS3, AzureBlob etc.).
rootFolder.Location = @"Type=Physical; Path=c:\SomeFolder\RootFolder";

Setting root folder location in ASPX markup:

ASPX
<%-- 
Setting a physical path string:
See below for other path string examples.
--%>
<GleamTech:FileManagerRootFolder Name="Root Folder 1" Location="c:\SomeFolder\RootFolder" />

<%-- 
Setting a virtual path string:
See below for other path string examples.
--%>
<GleamTech:FileManagerRootFolder Name="Root Folder 1" Location="~/App_Data/RootFolder" />

<%-- 
Setting a provider string:
See below for other provider string examples.
--%>
<GleamTech:FileManagerRootFolder Name="Root Folder 1" Location="Type=Physical; Path=c:\SomeFolder\RootFolder" />

  Notes to Callers

Below are the examples for setting a Location parameter/property.

Setting a plain string:

C#
Location location;

//Setting a physical path string:
//This is parsed as a PhysicalLocation instance.
location = @"c:\SomeFolder";

//Setting a virtual path string:
//This is parsed as a PhysicalLocation instance and virtual path is resolved on access.
//Note that virtual paths can only be resolved in a web application
//and on Linux paths starting with "/" are physical paths and not virtual paths.
location = "~/SomeFolder";

Setting a physical location:

C#
Location location;

//Setting a physical location via a PhysicalLocation instance:
location = new PhysicalLocation
{
    //Path can also be virtual path string like "~/App_Data/SomeFolder" in a web application.
    Path = @"c:\SomeFolder"
};

//Setting a physical location via a provider string (same as above):
location = @"Type=Physical; Path=c:\SomeFolder";

//---------------------------------------

//Setting a physical location via a PhysicalLocation instance, to connect as a specific user:
//UserName can be specified as "Domain\User", "User@Domain" (UPN format), "Machine\User", "User" (local user).
location = new PhysicalLocation
{
    Path = @"\\server\share", //a UNC path or a local path
    UserName = "USERNAME",
    Password = "PASSWORD"
};

//Setting a physical location via a provider string, to connect as a specific user (same as above):
//In a provider string, if a value contains semi-colon character, that value should be enclosed
//in single quotes (eg. Password='PASS;WORD') or double quotes (eg. Password="PASS;WORD").
location = @"Path=\\server\share; User Name=USERNAME; Password=PASSWORD";

//---------------------------------------

//Setting a physical location via a PhysicalLocation instance, to connect as the authenticated user:
//If Windows Authentication is used in IIS for this site, location can be specified like this
//to connect as the already authenticated user: 
location = new PhysicalLocation
{
    Path = @"\\server\share", //a UNC path or a local path
    AuthenticatedUser = AuthenticatedUser.Windows
};

//Setting a physical location via a provider string, to connect as the authenticated user:
location = @"Path=\\server\share; Authenticated User=Windows";

Setting an Azure Blob location:

C#
Location location;

//Setting an Azure Blob location via an AzureBlobLocation instance:
location = new AzureBlobLocation
{
    //Leave Path empty to connect to the root of the container. 
    //For connecting to subfolders, Path should be specified as a relative path (eg. "some/folder")
    //Path = "some/folder",

    //Get these values from your Azure Portal (Storage Account -> Access Keys -> Connection String)
    Container = "CONTAINER",
    AccountName = "XXX",
    AccountKey = "XXX"
};

//Setting an Azure Blob location via a provider string (same as above):
//In a provider string, if a value contains semi-colon character, that value should be enclosed
//in single quotes (eg. Password='PASS;WORD') or double quotes (eg. Password="PASS;WORD").
location = "Type=AzureBlob; Container=CONTAINER; Account Name=XXX; Account Key=XXX";

Setting an Amazon S3 location:

C#
Location location;

//Setting an Amazon S3 location via an AmazonS3Location instance:
location = new AmazonS3Location
{
    //Leave Path empty to connect to the root of the bucket. 
    //For connecting to subfolders, Path should be specified as a relative path (eg. "some/folder")
    //Path = "some/folder",

    BucketName = "BUCKET",
    Region = "eu-central-1",
    AccessKeyId = "XXX",
    SecretAccessKey = "XXX",
};

//Setting an Amazon S3 location via a provider string (same as above):
//In a provider string, if a value contains semi-colon character, that value should be enclosed
//in single quotes (eg. Password='PASS;WORD') or double quotes (eg. Password="PASS;WORD").
location = "Type=AmazonS3; Bucket Name=BUCKET; Region=eu-central-1; Access Key Id=XXX; Secret Access Key=XXX";

See Also