This is a migrated thread and some comments may be shown as answers.

FileExplorer with custom provider works in dev environment but not on the live server

1 Answer 53 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Warren
Top achievements
Rank 1
Warren asked on 29 Apr 2012, 12:40 AM
i'm using a custom provider to prevent the control from listing a settings file in each folder. it works fine in my development environment but on the live server if the custom provider is used, the control will not list any files under a folder. the wait indicator spins and spins and the files never load. i tested the control on the live server without the custom provider and it works fine.  i'm using the provided example for the custom provider and did not make any changes other than the IsFiltered method. any ideas?

public class CustomProvider : FileSystemContentProvider

    {

        public CustomProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)

            : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)

        { }

        public override DirectoryItem ResolveDirectory(string path)

        {

            DirectoryItem originalFolder = base.ResolveDirectory(path);

            FileItem[] originalFiles = originalFolder.Files;

            List<FileItem> filteredFiles = new List<FileItem>();

            // Filter the files

            foreach (FileItem originalFile in originalFiles)

            {

                if (!this.IsFiltered(originalFile.Name))

                {

                    filteredFiles.Add(originalFile);

                }

            }

            DirectoryItem newFolder = new DirectoryItem(originalFolder.Name, originalFolder.Location, originalFolder.FullPath, originalFolder.Tag, originalFolder.Permissions, filteredFiles.ToArray(), originalFolder.Directories);

            return newFolder;

        }

        public override DirectoryItem ResolveRootDirectoryAsTree(string path)

        {

            DirectoryItem originalFolder = base.ResolveRootDirectoryAsTree(path);

            DirectoryItem[] originalDirectories = originalFolder.Directories;

            List<DirectoryItem> filteredDirectories = new List<DirectoryItem>();

            // Filter the folders 

            foreach (DirectoryItem originalDir in originalDirectories)

            {

                if (!this.IsFiltered(originalDir.Name))

                {

                    filteredDirectories.Add(originalDir);

                }

            }

            DirectoryItem newFolder = new DirectoryItem(originalFolder.Name, originalFolder.Location, originalFolder.FullPath, originalFolder.Tag, originalFolder.Permissions, originalFolder.Files, filteredDirectories.ToArray());

            return newFolder;

        }

        private bool IsFiltered(string name)

        {

            return name == Web.SETTINGS_FILENAME;

        }

1 Answer, 1 is accepted

Sort by
0
Warren
Top achievements
Rank 1
answered on 30 Apr 2012, 07:51 PM
i downgraded the project from .net 4.0 to .net 3.5 and that fixed the problem
Tags
FileExplorer
Asked by
Warren
Top achievements
Rank 1
Answers by
Warren
Top achievements
Rank 1
Share this question
or