public virtual ActionResult Index(string folder, string subFolder) { FileSystemDriver driver = new FileSystemDriver(); var root = new Root( new DirectoryInfo(Server.MapPath("~/Files/" + folder)), "http://" + Request.Url.Authority + "/Files/" + folder) { // Sample using ASP.NET built in Membership functionality... // Only the super user can READ (download files) & WRITE (create folders/files/upload files). // Other users can only READ (download files) // IsReadOnly = !User.IsInRole(AccountController.SuperUser) IsReadOnly = false, // Can be readonly according to user's membership permission Alias = "Files", // Beautiful name given to the root/home folder MaxUploadSizeInKb = 500, // Limit imposed to user uploaded file <= 500 KB LockedFolders = new List<string>( new string[] { "Folder1"}) }; // Was a subfolder selected in Home Index page? if (!string.IsNullOrEmpty(subFolder)) { root.StartPath = new DirectoryInfo(Server.MapPath("~/Files/" + folder + "/" + subFolder)); } driver.AddRoot(root); var connector = new Connector(driver); return connector.Process(this.HttpContext.Request); }
/// <summary> /// Adds an object to the end of the roots. /// </summary> /// <param name="item"></param> public void AddRoot(Root item) { _roots.Add(item); item.VolumeId = _volumePrefix + _roots.Count + "_"; }