Notes to Callers
Below are the examples for setting a Location parameter/property.
This property can be set to:
public Location CacheLocation { get; set; }
Public Property CacheLocation As Location
Get
Set
Setting global cache location in code:
//Setting a physical path string:
//See below for other path string examples.
DocumentUltimateWebConfiguration.Current.CacheLocation = @"c:\SomeFolder\DocumentCache";
//Setting a virtual path string:
//See below for other path string examples.
DocumentUltimateWebConfiguration.Current.CacheLocation = "~/App_Data/DocumentCache";
//Setting a location provider instance:
//See below for other location provider examples (UNC Path, AmazonS3, AzureBlob, Database etc.).
DocumentUltimateWebConfiguration.Current.CacheLocation = new PhysicalLocation
{
Path = @"c:\SomeFolder\DocumentCache"
};
//Setting a provider string:
//See below for other provider string examples (UNC Path, AmazonS3, AzureBlob, Database etc.).
DocumentUltimateWebConfiguration.Current.CacheLocation = @"Type=Physical; Path=c:\SomeFolder\DocumentCache";
'Setting a physical path string:
'See below for other path string examples.
DocumentUltimateWebConfiguration.Current.CacheLocation = "c:\SomeFolder\DocumentCache"
'Setting a virtual path string:
'See below for other path string examples.
DocumentUltimateWebConfiguration.Current.CacheLocation = "~/App_Data/DocumentCache"
'Setting a location provider instance:
'See below for other location provider examples (UNC Path, AmazonS3, AzureBlob, Database etc.).
DocumentUltimateWebConfiguration.Current.CacheLocation = New PhysicalLocation() With {
.Path = "c:\SomeFolder\DocumentCache"
}
'Setting a provider string:
'See below for other provider string examples (UNC Path, AmazonS3, AzureBlob, Database etc.).
DocumentUltimateWebConfiguration.Current.CacheLocation = "Type=Physical; Path=c:\SomeFolder\DocumentCache"
Setting global cache location in appsettings.json file:
{
//Setting a path string:
//See below for other path string examples.
"DocumentUltimateWeb:CacheLocation": "c:\\SomeFolder\\DocumentCache",
//Setting a provider string:
//See below for other provider string examples.
"DocumentUltimateWeb:CacheLocation": "Type=Physical; Path=c:\\SomeFolder\\DocumentCache"
}
//
Setting global cache location in <appSettings> tag of Web.config file:
<appSettings>
<!--
Setting a physical path string:
See below for other path string examples.
-->
<add key="DocumentUltimateWeb:CacheLocation" value="c:\SomeFolder\DocumentCache"/>
<!--
Setting a virtual path string:
See below for other path string examples.
-->
<add key="DocumentUltimateWeb:CacheLocation" value="~/App_Data/DocumentCache"/>
<!--
Setting a provider string:
See below for other provider string examples.
-->
<add key="DocumentUltimateWeb:CacheLocation" value="Type=Physical; Path=c:\SomeFolder\DocumentCache"/>
</appSettings>
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"