locked
Acess denied creating folder using windows authentication RRS feed

  • Question

  • User219464869 posted

    I have an ASP.NET 2010 web application that runs from our company Intranet server which is an old Windows 2003 server. 

    The web app has a function which creates a sub folder on one of our network drives.  The folder above is not shared.  When I run the web app locally, this sub folder is created fine but when I run it after publishing it to IIS, I get an error saying access to \\10.225.1.1\MyFolder\MySub is denied.

    My app uses Windows authentication and allows impersonation.

    My web.config code looks like this:

        <authentication mode="Windows" />
    
        <authorization>
          <deny users="?" />
        </authorization>
    
        <identity impersonate="true"/>
    

    I have tried variations on this without success.  I’ve trawled the web and have tried all of the suggestions but I just can’t seem to get it to allow access to create the folder.

    Here’s my code on the submit button which works locally but not when live.

    Dim varCreateDirectory As String = tempFileLocation & tempECNNumber
    
    If Directory.Exists(varCreateDirectory) = False Then
                  Directory.CreateDirectory(varCreateDirectory)
                  Directory.CreateDirectory(varCreateDirectory & tempFileLocation_Sub1)
    End If
    
     
    
    

    As a test, I even gave the MyFolder security permission of Full Control to “Everyone” and it still says access is denied.  I’ve added security privileges of Full Control to “SYSTEM”, “NETWORK”, “ASP.NET” (which I believe is the credentials is supplies), “IIS_WPG” and “NETWORK SERVICE” just to test but still nothing.

    Has anyone got any suggestions on what I could be doing wrong?  I’m not great with IIS or security but I’ve managed to get a very similar system running on the same server in the past without a problem.  The only difference between the old system is that I’m using a .NET 2 application pool for that which works and the new system uses a separate .NET 4 application pool.

    Thursday, May 1, 2014 4:31 AM

Answers

  • User-1353043493 posted

    set an Admin Account in the <identity..> (user & pass) and see what happens.

    <configuration>
    <system.web>
    <identity impersonate="true" userName="DMN\UserName" password="password" />
    </system.web>
    </configuration>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 1, 2014 5:04 AM

All replies

  • User-1353043493 posted

    set an Admin Account in the <identity..> (user & pass) and see what happens.

    <configuration>
    <system.web>
    <identity impersonate="true" userName="DMN\UserName" password="password" />
    </system.web>
    </configuration>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 1, 2014 5:04 AM
  • User219464869 posted

    Great Dharmesh, that worked.

    I used my own acount as a quick test so I'll create an admin account and use that.

    Thanks for taking the time to help out.

    Thursday, May 1, 2014 5:24 AM