public JsonResult Browse(string path)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            BrowseResult result;
            if (string.IsNullOrEmpty(path) || path == "/")
            {
                var root = files.GetRootFolder();
                var rootPath = VirtualPathUtility.AppendTrailingSlash(root != null ? root.Name : string.Empty);
                result = new BrowseResult
                             {
                                 Files = files.Images(root),
                                 Directories = files.Folders(root),
                                 Path = rootPath,
                                 ContentPaths = new[] {rootPath}
                             };
            }
            else
            {
                result = new BrowseResult
                             {
                                 Files = files.Images(path),
                                 Directories = files.Folders(path),
                                 Path = VirtualPathUtility.AppendTrailingSlash(path),
                                 ContentPaths = new[] { VirtualPathUtility.AppendTrailingSlash(path) }
                             };
            }
            return Json(result);
        }
        public JsonResult Browse(string path)
        {
            path = Path.Combine(ContentPaths[0], path).Replace('\\', '/') + "/";

            var _client = new DropNetClient(accessKey, secretAccessKey, userTokenKey, userSecretKey);
            var _metaData = _client.GetMetaData(path);

            BrowseResult result = new BrowseResult();
            result.ContentPaths = ContentPaths;
            result.Path = path;

            result.Files = _metaData.Contents.Where(e => e.Extension != "").Select(e =>
                {
                    long size = 0;
                    if (e.Size.Contains(" B"))
                        size = (long)double.Parse(e.Size.Replace(" B", "").Replace('.', ','));
                    else if( e.Size.Contains(" KB"))
                        size = (long)(double.Parse(e.Size.Replace(" KB", "").Replace('.', ',')) * 1024);
                    else if (e.Size.Contains(" MB"))
                        size = (long)(double.Parse(e.Size.Replace(" MB", "").Replace('.', ',')) * 1024 * 1024);
                    else if (e.Size.Contains(" GB"))
                        size = (long)(double.Parse(e.Size.Replace(" GB", "").Replace('.', ',')) * 1024 * 1024 * 1024);
                    return new FileEntry { Name = e.Name, Size = size };
                });
            result.Directories = _metaData.Contents.Where(e => e.Extension == "").Select(e => new DirectoryEntry { Name = e.Name });

            return this.Json(result);
        }
        /// <summary>
        /// Retrieves the content of a given folder.
        /// </summary>
        /// <param name="path">The folder's path, which content will be served.</param>
        /// <returns>A <see cref="JsonResult"/> containing folder's files and child folders.</returns>
        /// <exception cref="HttpException">Throws 403 Forbidden if the supplied <paramref name="path"/> is outside of the valid paths.</exception>
        /// <exception cref="HttpException">Throws 404 File Not Found if refered folder does not exist.</exception>
        public virtual JsonResult Browse(string path)
        {
            path = NormalizePath(path);

            if (AuthorizeBrowse(path))
            {
                try
                {
                    directoryBrowser.Server = Server;

                    var result = new BrowseResult
                    {
                        Files        = directoryBrowser.GetFiles(path, Filter),
                        Directories  = directoryBrowser.GetDirectories(path),
                        Path         = pathProvider.AppendTrailingSlash(path),
                        ContentPaths = ContentPaths.Select(root => pathProvider.ToAbsolute(root)).ToArray()
                    };

                    return(Json(result));
                }
                catch (DirectoryNotFoundException)
                {
                    throw new HttpException(404, "File Not Found");
                }
            }

            throw new HttpException(403, "Forbidden");
        }
        /// <summary>
        /// Retrieves the content of a given folder.
        /// </summary>
        /// <param name="path">The folder's path, which content will be served.</param>
        /// <returns>A <see cref="JsonResult"/> containing folder's files and child folders.</returns>
        /// <exception cref="HttpException">Throws 403 Forbidden if the supplied <paramref name="path"/> is outside of the valid paths.</exception>
        /// <exception cref="HttpException">Throws 404 File Not Found if refered folder does not exist.</exception>
        public virtual JsonResult Browse(string path)
        {
            path = NormalizePath(path);

            if (AuthorizeBrowse(path))
            {
                try
                {
                    directoryBrowser.Server = Server;

                    var result = new BrowseResult
                    {
                        Files = directoryBrowser.GetFiles(path, Filter),
                        Directories = directoryBrowser.GetDirectories(path),
                        Path = pathProvider.AppendTrailingSlash(path),
                        ContentPaths = ContentPaths.Select(root => pathProvider.ToAbsolute(root)).ToArray()
                    };

                    return Json(result);
                }
                catch (DirectoryNotFoundException)
                {
                    throw new HttpException(404, "File Not Found");
                }
            }

            throw new HttpException(403, "Forbidden");
        }