Permission issues with delete of items

7 posts, 3 answers
  1. Steven
    Steven avatar
    9 posts
    Member since:
    Dec 2011

    Posted 10 Feb 2012 Link to this post

    During an attempt to delete individual items from the RadFileExplorer, the below Message from webpage results:

    The selected file could not be deleted because the application did not have enough permissions. Please, contact the administrator.

    However, I am able to delete a folder from the RadFileExplorer. 

    Below is the code - .aspx and C# ; The RadFileExplorer is populated in the C#, after a read to an SQL Server table; 

    Any insight is appreciated;

    <telerik:RadFileExplorer ID="RadFileExplorer1" Runat="server" Width="100%" Height="600px" ExplorerMode="FileTree" onclientitemselected="OnClientItemSelected" 
                        OnClientLoad="OnFileExplorerLoad" VisibleControls="TreeView, Grid, Toolbar, ContextMenus" TreePaneWidth="100%" BorderColor="Transparent" BorderStyle="None" 
                        EnableCopy="True" EnableOpenFile="False" MaxUploadFileSize="2147483647" ViewStateMode="Enabled">
                 </telerik:RadFileExplorer>
    using (SqlConnection connection = new SqlConnection(newConnect))
                           {
                               // Create the Command and Parameter objects;
                               SqlCommand command = new SqlCommand(queryString, connection);
                               // Open the connection in a try/catch block; 
                               // Create and execute the DataReader; 
                               try
                               {
                                   connection.Open();
                                   SqlDataReader reader = command.ExecuteReader();
                                     
                                   while (reader.Read())
                                   {                                   
                                       UsernameDB = (reader[1]).ToString();
                                       listViewPaths.Add(reader.GetString(3));
                                       listUploadDeletePaths.Add(reader.GetString(4));
                                       WebPageTitle = (reader[5]).ToString();
                                   }
                                   reader.Close();
                               }
                               catch (Exception ex)
                               {
                               }
                           }
                       }
                   }
                   Page.Title = WebPageTitle;
                   RadFileExplorer1.Configuration.ViewPaths = listViewPaths.ToArray();
                   RadFileExplorer1.Configuration.UploadPaths = listUploadDeletePaths.ToArray();
                   RadFileExplorer1.Configuration.DeletePaths = listUploadDeletePaths.ToArray();
  2. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 13 Feb 2012 Link to this post

    Hi Steven,

    Could you please verify that the ASP.NET user have the correct permissions to delete files from the folder? You can test this using the example from the following help article:
    Troubleshooting

    Also, could you please provide more detailed information on the specific scenario? Do you have applied any modifications to RadFileExplorer - using custom content provider, handled server-side / client-side events, etc.? If so, could you please open a formal support ticket and provide sample project demonstrating the problem?

    Regards,
    Dobromir
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steven
    Steven avatar
    9 posts
    Member since:
    Dec 2011

    Posted 13 Feb 2012 Link to this post

    The application does not work with a custom content provider;

    The ViewPaths, UploadPaths, and DeletePaths are obtained from an SQL Server table - in the following format :

    \Documents\Customers\xxxx

    RadFileExplorer1.Configuration.ViewPaths = listViewPaths.ToArray();
    RadFileExplorer1.Configuration.UploadPaths = listUploadDeletePaths.ToArray();
                RadFileExplorer1.Configuration.DeletePaths = listUploadDeletePaths.ToArray();


    There are no issues for other operations - Rename, New Folder, Upload, and Copy;

    I am able to delete a folder with new, and old, items;

    However, during an attempt to Delete an individual item within a folder, the following Message from webpage occurs:
     
    "The selected file could not be deleted because the application did not have enough permissions.  Please, contact the administrator."

    I ran the Full Permissions test from the URL : http://www.telerik.com/help/aspnet-ajax/fileexplorer-general-troubleshooting.html - with no errors;

    Thanks in advance for any insight;
  5. Steven
    Steven avatar
    9 posts
    Member since:
    Dec 2011

    Posted 13 Feb 2012 Link to this post

    On the web server, permissions are set as follows:

    Everyone, LOCAL SERVICE, NETWORK SERVICE, Administrator, Users - all entities have Full Control;

    Should the Read-only check box be un - checked?
  6. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 15 Feb 2012 Link to this post

    Hi Steven,

    By design, the default RadFileExplorer's content provider does not allow deletion of read-only files. If you do need the read-only to be set to the file and still be able to delete it you need to subclass the FileSystemContentProvider and override its DeleteFile() method, e.g.:
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RadFileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomFileSystemProvider).AssemblyQualifiedName;
        }
     
    }
     
    public class CustomFileSystemProvider : FileSystemContentProvider
    {
        public CustomFileSystemProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
            : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
        {
        }
     
        public override string DeleteFile(string path)
        {
            string physicalPath = MapPath(RemoveProtocolNameAndServerName(path));
            try
            {
                if (File.Exists(physicalPath))
                {
                    File.Delete(physicalPath);
                }
            }
            catch (UnauthorizedAccessException)
            {
                return "NoPermissionsToDeleteFile";
            }
            return string.Empty;
        }
     
    }

    I hope this helps.

    All the best,
    Dobromir
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. Steven
    Steven avatar
    9 posts
    Member since:
    Dec 2011

    Posted 17 Feb 2012 Link to this post

    Thank you for the reply, and the code sample;

    Next question is how best to wire up a selected file with the DeleteFile method;

    In debug mode, the string[] deletePaths contains the correct path, and breakpoints are hit if an attempt is made to delete a file;

    However - prior to calling DeleteFile(string path), the actual selected file is necessary to have been obtained, not just the path;
  8. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 21 Feb 2012 Link to this post

    Hi Steven,

    I am not quite sure I understand the exact question. Could you please elaborate on what do you mean by "wire up a selected file with the DeleteFile method" and "However - prior to calling DeleteFile(string path), the actual selected file is necessary to have been obtained, not just the path;".

    In general, RadFileExplorer does not provide information regarding the selected item on the server, when a command is executed the explorer passes the path of the item upon which the command should be executed and the content provider handles the direct operations with the FileSystem.

    Regards,
    Dobromir
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017