Asp.net 4 FileUpload gets "Permission Denied" when Uploading file RRS feed

  • Question

  • User-1359517959 posted

    There's 2 apps that upload files.  Both have been running fine.  Files were able to be uploaded.  I uploaded a file through it 3 days ago and it worked.  This morning it comes up with an error: "Access to the path 'D:\....." is denied."

    It's happening write at this code line
           FileUpload1.SaveAs(thisSaveServer + savePath)
    I looked at the code for thisSaveServer and savePath and it looks good -hasn't changed

    Here's the weird thing.  There's 1 IIS server and 4 webs on it.  2 Webs for testing (A & B)  2 webs for production (C & D)
    In each case Web B uploads to Web A and Web D uploads to Web C.  A Virtual Directory is used in each case.
                 Production (Web D->C) works great
                 Testing Web(B->A) gives me an error.

    I copied the file from Production to Testing and got the same error.  So it's not the code.

    I look at the permissions and they are identical.   IIS_MACHINENAME  has full control
    For the application pools identity they are using ApplicationPoolIdentity 

    Any ideas on where I could investigate and find what's happening?  Talked to the server guys and they said they didn't change anything. 


    Monday, April 3, 2017 5:15 PM

All replies

  • User-1509636757 posted

    Try by providing appropriate (preferably full) access rights to IIS_IUSRS & IUSR to folders to which uploading the file gives you "Permission Denied" error.

    Monday, April 3, 2017 6:07 PM
  • User-2057865890 posted

    Hi Jess,

    To fix this you will need to change the security permissions on the appropriate directories. Specifically, ASP.NET requires read, execute, and list access for the ASPNET account for the web site root (for example: c:\inetpub\wwwroot or any alternative site directory you may have configured in IIS), the content directory and the application root directory in order to monitor for configuration file changes.

    To add permissions to a directory, perform the following steps:

    • Using the Windows explorer, navigate to the directory
    • Right click on the directory folder and choose "Properties"
    • Navigate to the "Security" tab on the property dialog
    • Click the "Add" button and enter the machine name followed by the ASPNET account name. For example, on a machine named "webdev", you would enter webdev\ASPNET and hit "OK".
    • Ensure that the ASPNET account has the "Read & Execute", "List Folder Contents", and "Read" checkboxes checked.
    • Hit OK to dismiss the dialog and save the changes.

    Best Regards,


    Wednesday, April 5, 2017 6:09 AM