Delete File Error

3 posts, 1 answers
  1. gianemilio redaelli
    gianemilio redaelli avatar
    4 posts
    Member since:
    Jan 2010

    Posted 20 Jan 2011 Link to this post

    Hi everybody,

    I configured my fe control to work on a virtual directory (IIS 6.0 on a WinSRV 2003).
    WindowsAuthentication set to True, Impersonation set to True.

    I can upload files, create folder, DELETE folder, but I receive a js alert when I try to delete or rename a file. The message say: "The selected file could not be deleted because the application did not have enough permissions. Please contact the administrator."
    I give the impersonated user full controls to the folder but nothing ...

    private void initFileManager()
        var sBPResourcePath = getBPResourcesPath();
        var arBPResourcePaths = new string[] { sBPResourcePath };
        rfeFileExplorer.AllowPaging = false;
        rfeFileExplorer.Configuration.DeletePaths = arBPResourcePaths;
        rfeFileExplorer.Configuration.UploadPaths = arBPResourcePaths;
        rfeFileExplorer.Configuration.ViewPaths = arBPResourcePaths;
        rfeFileExplorer.DisplayUpFolderItem = true;
        rfeFileExplorer.EnableCreateNewFolder = true;
        rfeFileExplorer.EnableOpenFile = true;
        //rfeFileExplorer.InitialPath = sBPResourcePath;
        rfeFileExplorer.Language = _sessionInfo.CurrentCultureCode;
        rfeFileExplorer.VisibleControls = GetVisibleControls();
    private FileExplorerControls GetVisibleControls()
        FileExplorerControls explorerControls = 0;
        // explorerControls |= Telerik.Web.UI.FileExplorer.FileExplorerControls.AddressBox;
        explorerControls |= FileExplorerControls.Grid;
        explorerControls |= FileExplorerControls.Toolbar;
        explorerControls |= FileExplorerControls.TreeView;
        explorerControls |= FileExplorerControls.ContextMenus;
        return explorerControls;
  2. Answer
    Dobromir avatar
    1633 posts

    Posted 25 Jan 2011 Link to this post

    Hi Gianemilio,

    I already answered your support ticket on the subject. For convenience I will paste my answer here as well.

    The problem that you experience is a permission issue with the permissions of the files on the IIS serve. Please note that, however, I do not know the configuration of your server and cannot provide you with a definitely working solution.

    You can use the the following approach to test the permission on the server:
    • Remove the RadFileExplorer (or all RadControls) from the page
    • In the code behind of the same page where the RadFileExplorer was declared add this code:
      protected void Page_Load(object sender, EventArgs e)
          string testPhysicalPath = "Path";// Physical path to an existing directory
      private void FillPermissionsTest(string testPhysicalPath)
              string physicalPathToTestFolder = System.IO.Path.Combine(testPhysicalPath, "TestDirectory");
              System.IO.DirectoryInfo testDir = System.IO.Directory.CreateDirectory(physicalPathToTestFolder);// Create folder
              testDir.GetDirectories();// List folders
              string testFilePath = System.IO.Path.Combine(testDir.FullName, "TestFile1.txt");// test file paths
              System.IO.File.Create(testFilePath);// Create a file
              testDir.GetFiles("*.*");// List files
              System.IO.File.OpenRead(testFilePath).Close();// Open a file
              System.IO.File.Delete(testFilePath);// delete the test file
              System.IO.Directory.Delete(physicalPathToTestFolder);// delete the test folder
          catch (Exception ex)
          {// Show the probelm
              string message = ex.Message;
              string script = string.Format("alert('{0}');", message);
              ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "KEY", script, true);
    • The "Paths" string should be replaced with the paths that are set to the ViewPaths, UploadPaths and DeletePaths properties of the RadFileExplorer. You can use Server.MapPath in order to retrieve the in order to get the physical paths (for example: Server.MapPath("~/App_Data/ExampleVirtualPath")), because these methods accept physical path, not virtual.
    • You need to add a break point to the beginning of the Page_Load event and make sure that the code is executed without any exceptions.
    • If an exception is thrown, then you will be sure that the problem is in the Server's permissions set to the folder(s) and not in the RadControls.
    • The highlighted ex.Message property's value will be shown as an alert if an exception occurs.

    Could you please perform this test and let me know the result? In case, however, that an exception is thrown, then I recommend you to change the permissions of the folders based on the information provided in the error message.

    All the best,
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. DevCraft R3 2016 release webinar banner
  4. gianemilio redaelli
    gianemilio redaelli avatar
    4 posts
    Member since:
    Jan 2010

    Posted 25 Jan 2011 Link to this post

    Oooooopppsssss .... forget about that!!!

    There was MY ERROR in building the paths in the getBPResourcesPath() method!

    private string getBPResourcesPath()
        if (!sResourcesBasePath.EndsWith(@"\"))
            sResourcesBasePath += @"\"; 
        return sResourcesBasePath + SERVICE_BPCODE;

    I have to use "/" instead of "\" ... the strange thing is that the folder tree is build correctly.

    Sorry for boring you.

Back to Top