locked
Access path denied when creating new folder in file server. RRS feed

  • Question

  • User-1024101449 posted

    I am trying to create new directory and placed some files in that folder.

    creating folder and saving the file in "File Server" (seperate file server). Ex : \\Server101\Country\Projects.

    "We are maintaining Application in one server (i.e. Application Server) and Folder creation in another server (i.e. File Server)"

    When we trying to create a folder in the above path, it's showing "Access denied" error.

    Error : Access to the path '\\Server101\Country\Projects' is denied.

    The file server path has already given read/write access for those who are all creating folder through ASP.net application.

    How to handle this problem.

    below is my simple code.

            Dim fp As String = "\\Server101\Country\Project"    'File Server path (another server)
    
            If (Not System.IO.Directory.Exists(fp)) Then
                System.IO.Directory.CreateDirectory(fp)
            End If
    
            File.Create(fpath & "\test.txt").Dispose()
    

    Thursday, January 31, 2019 12:57 PM

Answers

All replies

  • User753101303 posted

    Hi,

    With the default configuration the code runs under the account configured for the web application (not under the account of each authenticated user) and it's this account that should be granted access. See https://docs.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities#securing-resources

    And/or you may also have a typo. I noticed you are have "Projects" when describing what happens but your code uses "Project".

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 31, 2019 1:22 PM
  • User-1024101449 posted

    Sorry.

    it is "projects" only.

    Dim fp As String = "\\Server101\Country\Projects"

    The same code works in local system. It means the code will create folder and text file in file server.

    But, while running from the server through IIS, it isays "Access path denied Error"

    Almost i have given all the settings in IIS Application folder and File Server folder.

    Still getting problem...How to identify the error....

    Thursday, January 31, 2019 1:46 PM
  • User1724605321 posted

    Hi gani7787,

    Almost i have given all the settings in IIS Application folder and File Server folder.

    Could you please tell us which operation you have done ? And do you  find out from the application pool for the website what is the identity it is running under  and grant correct permission ?

    Best Regards,

    Nan Yu

    Friday, February 1, 2019 2:43 AM
  • User-1024101449 posted

    pls. find screenshot below for your reference (screenshot attached in the below link.

    1. FileServer Folder permission settings (from Security tab)
    2. IIS Application Folder permission settings (from Securtiy tab)

    https://1drv.ms/f/s!AiSRcgO5FUmNgQVuMTLx2R6alYEk

    Note : i'm using IIS 7.5

    Friday, February 1, 2019 4:36 AM