Skip to main content
A newer version of this page is available. .
Tab

FileManagerFileAccessRule.Download Property

Gets or sets the download action permission.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(Rights.Default)]
public Rights Download { get; set; }

Property Value

Type Default Description
Rights **Default**

One of the Rights enumeration values specifying the action permission.

Available values:

Name Description
Allow

The action is allowed within the access rule.

Deny

The action is denied within the access rule.

Default

The action has an identical permission as the current item (file or folder) parent element. It corresponds to the Rights.Allow permission if this value does not exist.

Remarks

ASPxFileManager allows you to define access permissions for folders and files using a set of file/folder access rules (FileManagerSettingsPermissions.AccessRules). An access rule specifies a path to which it is applied and lists permissions (allowed or denied actions) associated with this rule.

Use the Download property to specify whether end-users with the specified role (FileManagerAccessRuleBase.Role) can download a file(s) specified in the current access rule (via the FileManagerAccessRuleBase.Path property).

Concept

Example

WebForms (declaratively):

<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">    
    <SettingsPermissions>
        <AccessRules>
            <dx:FileManagerFileAccessRule Edit="Deny" Browse="Allow" Path="*.docx" />
            <dx:FileManagerFolderAccessRule Role="Administrator"  EditContents="Allow" Browse="Allow" Path="Documents" />
        </AccessRules>
    </SettingsPermissions>
</dx:ASPxFileManager>

WebForms (in code):

ASPxFileManager fm = new ASPxFileManager();
...
FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
fileRule.Path = "*.docx";
fileRule.Edit = Rights.Allow;
fileRule.Download = Rights.Allow;

FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
folderRule.Role = "Administrator";
folderRule.EditContents = Rights.Allow;
folderRule.Browse = Rights.Allow;

FileManager.SettingsPermissions.AccessRules.Add(fileRule);
FileManager.SettingsPermissions.AccessRules.Add(folderRule);
...

MVC:

@Html.DevExpress().FileManager( settings => {
    settings.Name = "fileManager";

    FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
    fileRule.Path = "*.docx";
    fileRule.Edit = Rights.Allow;
    fileRule.Download = Rights.Allow;

    FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
    folderRule.Role = "Administrator";
    folderRule.EditContents = Rights.Allow;
    folderRule.Browse = Rights.Allow;

    FileManager.SettingsPermissions.AccessRules.Add(fileRule);
    FileManager.SettingsPermissions.AccessRules.Add(folderRule);
    ...
}).BindToFolder(Model).GetHtml()

Online Demo

See Also