Custom FileSystemProvider access denied when uploading.

2 posts, 0 answers
  1. Josh
    Josh avatar
    3 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    I am working on a FileSystemProvider that will allow writing to a physical or shared drive.  Most of the functionality seems to be working but the StoreFile method is having issues.

    Below is the code I am using

    public override string StoreFile(Telerik.Web.UI.UploadedFile file, string path, string name, params string[] arguments)
    {
        var virtualSavePath = Path.Combine(path, name);
        var physicalPath = GetPhysicalFromVirtualPath(path);
        File.Create(Path.Combine(physicalPath, "joshtest"));
        if (physicalPath == null)
            return string.Empty;
     
        file.SaveAs(physicalPath);
     
        // Returns the path to the newly created file
        return virtualSavePath;
    }

    the file.SaveAs(physicalPath) throws an access denied exception.  The File.Create(...) works and creates the file so it seems that iis has access to create files. 

    I am also able to create/delete/move folders and delete files (only tried to delete and upload files).

    Am I missing something here that is causing file.SaveAs to not work properly?
  2. Josh
    Josh avatar
    3 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    I must have misunderstood what to pass SaveAs and was passing it the directory to save instead of the path+name.  Fixed and it appears to be working now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top