Need help with a web application I am writing in ASP.NET the code runs fine on LocalHost but bombs with a ‘Could not find part of path’ error when I try to run it on the server (IIS 7.5 on Windows Server 2008 R2).
What is bombing is a section where I am testing to see if a directory exists (If Directory.Exists) on our network transfer drive named after the users logon name so I am pretty certain my problem is permission or security related (see below).
I am already using impersonation in the sites Web.config file (see below) for other applications and I authenticate the user to our active directory based on their username (environment.username) and their form entered network password.
I have tried using UNCs (the error becomes 'access to path is denied') also a security manager class I came across and two methods to directly map the drives I need all to no avail.
What I need to be able to do is to copy a prototype file from one network location to this user transfer folder under another name as well as write a CSV file to the same location.
This is what MSDN has to say:
A service that runs under a LocalSystem account or under a local user account can only access mapped drives that the service creates. Mapped drives are stored for each logon session. If a service runs under a LocalSystem account or under a local user account that does not create certain mapped drives, the service cannot access these mapped drives. Additionally, a service that runs under a local user account that creates certain mapped drives also receives a new set of mapped drives if you log off and then you log on again as the same local user.
Any help will be appreciated.
Web.config
<authentication mode="Windows"/>
<authorization> <deny users="?"/> </authorization>
<identity impersonate="true"/>