Notes to Callers
Below are the examples for setting a Location parameter/property.
This property can be set to:
public Location Location { get; set; }
Public Property Location As Location
Get
Set
Setting root folder location in code:
//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 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() With {
.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:
<%--
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" />
Setting a plain string:
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";
Dim location As 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:
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";
Dim location As Location
'Setting a physical location via a PhysicalLocation instance:
'Path can also be virtual path string like "~/App_Data/SomeFolder" in a web application.
location = New PhysicalLocation() With {
.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() With {
.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() With {
.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:
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";
Dim location As Location
'Setting an Azure Blob location via an AzureBlobLocation instance:
'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)
location = New AzureBlobLocation() With {
.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:
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";
Dim location As Location
'Setting an Amazon S3 location via an AmazonS3Location instance:
'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",
location = New AmazonS3Location() With {
.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"