I am trying to get:
Directory.Exists(@"E:\subdirectory")
to return "true" when running from ASP.NET when E: is a persistent mapped network drive. I used the following command to map it from a command line running under the context of my user, which returns successfully and does not prompt for credentials:
net use E: \\servername\sharename /persistent:yes
At this point I'm running entirely locally.
When I run the Directory.Exists line from a console app or linqpad, it returns true. When I run this from an ASP.NET application running under IIS (not IIS express), it returns false.
I have changed my application pool to use the same user account I run as locally. I've verified this has taken effect by:
- Checking my windows process list and ensuring w3wp.exe is running under my user account.
- Attaching my ASP.NET application to w3wp.exe and setting a breakpoint, then checking Environment.UserName and Environment.UserDomainName to validate I'm running in the context of my user account.
However, my ASP.NET application still returns false when checking for the network share.
Why is this?