Cloud Storage Account Management

  • 2 min 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. This functionality, which allows end-users to work with files stored on a cloud storage service, can be implemented via the steps below.

  1. Register a cloud storage account in the global.asax file on the Application_Start event using the following methods of the AccountManager class.

    The example below illustrates how to register 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 a control. The following table lists AccountName properties for each control.

    Control

    Settings

    ASPxUploadControl

    UploadControlAmazonSettings.AccountName

    UploadControlAzureSettings.AccountName

    UploadControlDropboxSettings.AccountName

    UploadControlGoogleDriveSettings.AccountName

    UploadControlGoogleDrivePersonalSettings.AccountName (UploadControlGoogleDriveSettings.AccountName)

    UploadControlOneDriveSettings.AccountName

    UploadControlOneDrivePersonalSettings.AccountName (UploadControlOneDriveSettings.AccountName)

    ASPxFileManager

    FileManagerAmazonProviderSettings.AccountName

    FileManagerAzureProviderSettings.AccountName

    FileManagerDropBoxProviderSettings.AccountName

    FileManagerGoogleDriveProviderSettings.AccountName

    FileManagerGoogleDrivePersonalProviderSettings.AccountName (FileManagerGoogleDriveProviderSettings.AccountName)

    FileManagerOneDriveProviderSettings.AccountName

    FileManagerOneDrivePersonalProviderSettings.AccountName (FileManagerOneDriveProviderSettings.AccountName)

    ASPxHtmlEditor

    ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageSelector.SettingsAzure.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageSelector.SettingsAmazon.AccountName

    ASPxHtmlEditor.SettingsDialogs.InsertImageDialog.SettingsImageSelector.SettingsDropbox.AccountName

    
    <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>