Skip to main content

Custom File System Provider

  • 2 minutes to read

ASPxFileManager allows you to implement your own custom file system provider.


Follow the steps below to create a custom provider.

  1. Create a custom provider class that is inherited from the base FileSystemProviderBase class or from one of its ancestors.

    public class LinqFileSystemProvider : FileSystemProviderBase {
  2. Implement the required virtual methods in your class. If you inherit from FileSystemProviderBase, you must implement the following methods:

    public class LinqFileSystemProvider : FileSystemProviderBase {
         public override IEnumerable<FileManagerFile> GetFiles(FileManagerFolder folder) {
              DbFileSystemItem dbFolderItem = FindDbFolderItem(folder);
                   from dbItem in DataContext.DbFileSystemItems
                   where !dbItem.IsFolder && dbItem.ParentId == dbFolderItem.Id
                   select new FileManagerFile(this, folder, dbItem.Name);
         public override IEnumerable<FileManagerFolder> GetFolders(FileManagerFolder parentFolder) {
              DbFileSystemItem dbFolderItem = FindDbFolderItem(parentFolder);
              from dbItem in FolderCache.Values
              where dbItem.IsFolder && dbItem.ParentId == dbFolderItem.Id
              select new FileManagerFolder(this, parentFolder, dbItem.Name);
         public override bool Exists(FileManagerFile file) {
              return FindDbFileItem(file) != null;
         public override bool Exists(FileManagerFolder folder) {
              return FindDbFolderItem(folder) != null;
         public override System.IO.Stream ReadFile(FileManagerFile file) {
              return new MemoryStream(FindDbFileItem(file).Data.ToArray());

    Note that you do not need to override all the methods if your provider is inherited from another predefined provider.

  3. Use the ASPxFileManager.CustomFileSystemProvider or ASPxFileManager.CustomFileSystemProviderTypeName property to assign your provider class to ASPxFileManager.

    In markup:

    <dx:ASPxFileManager ID="ASPxFileManager1" runat="server" 
         CustomFileSystemProviderTypeName="LinqFileSystemProvider" >

    Programmatically (on the Page_Init event):

    public partial class FileManager_CustomFilterAPI : System.Web.UI.Page {
        protected void Page_Init(object sender, EventArgs e) {
            FileManager.CustomFileSystemProvider = new CustomFileSystemProvider(FileManager.Settings.RootFolder);
  4. Set the ASPxFileManager.ProviderType property to Custom to use a custom provider in ASPxFileManager.

View Example: ASPxFileManager - How to implement a LINQ to SQL based file system provider

Online Blogs

ASP.NET File Manager - Create A Custom File System Provider

See Also