Cloud Storage Account Management

  • 2 minutes to read

This topic describes how to connect the ASPxUploadControl, ASPxFileManager and ASPxHtmlEditor controls to popular cloud storage services such as Amazon, Azure, Dropbox, Google Drive, and OneDrive.
Follow the steps below to configure the functionality that allows end users to work with files stored on a cloud storage service.

  1. Use the following methods of the AccountManager class to register a cloud storage account within the Global.asax file in the Application_Start event handler.

    The example below registers cloud storage accounts in the Global.asax file.

    void Application_Start(object sender, EventArgs e) {
        DevExpress.Web.AccountManager.RegisterAzure("Azure1", "StorageName1", "AccessKey1");
        DevExpress.Web.AccountManager.RegisterAmazon("Amazon1", "AccessKeyID1", "SecretAccessKey1");
        DevExpress.Web.AccountManager.RegisterDropbox("Dropbox1", "AccessTokenValue1");
        DevExpress.Web.AccountManager.RegisterGoogleDrive("FileManagerGoogleDriveAccount", "custom-service-account@api-project-82456107.iam.gserviceaccount.com", "..MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVoaYrE7fEgu...");
        DevExpress.Web.AccountManager.RegisterGoogleDrivePersonal("FileManagerGoogleDrivePersonalAccount", "customClientID", "..MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVoaYrE7fEgu...");
        DevExpress.Web.AccountManager.RegisterOneDrive("FileManagerOneDriveAccount", "f49c387c-1c25-4f27-855b-dfd3fd3", "..+SKN3n5H0/KZVb6c=...");
    }
    
  2. Use a control's AccountName property to specify the storage account to be used by the control. The following table lists AccountName properties for each control.

    Control

    Settings

    ASPxUploadControl

    UploadControlAmazonSettings.AccountName

    UploadControlAzureSettings.AccountName

    UploadControlDropboxSettings.AccountName

    UploadControlGoogleDriveSettings.AccountName

    UploadControlGoogleDriveSettings.AccountName

    UploadControlOneDriveSettings.AccountName

    UploadControlOneDriveSettings.AccountName

    ASPxFileManager

    FileManagerAmazonProviderSettings.AccountName

    FileManagerAzureProviderSettings.AccountName

    FileManagerDropBoxProviderSettings.AccountName

    FileManagerGoogleDriveProviderSettings.AccountName

    FileManagerGoogleDriveProviderSettings.AccountName

    FileManagerOneDriveProviderSettings.AccountName

    FileManagerOneDriveProviderSettings.AccountName

    ASPxHtmlEditor

    ASPxHtmlEditor.SettingsDialogs.InsertMediaDialog.SettingsMediaSelector.SettingsAmazon.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertMediaDialog.SettingsMediaSelector.SettingsAzure.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertMediaDialog.SettingsMediaSelector.SettingsDropbox.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertMediaDialog.SettingsMediaUpload.AmazonSettings.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertMediaDialog.SettingsMediaUpload.AzureSettings.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertMediaDialog.SettingsMediaUpload.DropboxSettings.AccountName

    The placeholder Media can take the following values: Audio, Flash, Image, or Video.

    <dx:ASPxUploadControl ID="UploadControl" runat="server" UploadStorage="Azure">
        <AzureSettings AccountName="Azure1" ContainerName="uploadcontainer" />
    </dx:ASPxUploadControl>
    
    <dx:ASPxFileManager ID="FileManager" runat="server" ProviderType="Amazon">
        <SettingsAmazon AccountName="Amazon1" BucketName="filesbucket" Region="us-east-1" />
    </dx:ASPxFileManager>
    
    <dx:ASPxHtmlEditor ID="HtmlEditor" runat="server">
        <SettingsDialogs>
            <InsertImageDialog>
                <SettingsImageSelector Enabled="true" ProviderType="Dropbox">
                    <SettingsDropbox AccountName="Dropbox1" />
                </SettingsImageSelector>
                <SettingsImageUpload UploadStorage="Dropbox">
                    <DropboxSettings AccountName="Dropbox1" />
                </SettingsImageUpload>
            </InsertImageDialog>
        </SettingsDialogs>
    </dx:ASPxHtmlEditor>
    

    Run Demo: File Upload to Amazon Run Demo: File Manager for Amazon