(I suspect the problem is not with my code but with Windows and access issues, which is why I think this question is more suitable for SuperUser than StackOverflow)
I have problems accessing a mapped folder. The mapped folder (Y:), a link to the local folder C:\Projects... …\Configuration\Files\, contains configuration settings for our different environments (tst, dev etc). It is mapped using the subst command, as a bat-script run as administrator.
This folder is not always visible, see below:
The folder Y: is VISIBLE when:
- I navigate to it using Explorer (it’s a folder below Computer).
- I use Directory.Exists (C# code) to see if the folder exists
The folder Y: is NOT VISIBLE when:
- I wrap the Directory.Exists snippet in an Impersonation statement. The statement impersonates a user of our system (a CRM system). This is necessary to do to have access to other systems (SQL databases, for example).
What I have done:
- I have allowed access for the group Everyone on the folder Y:.
- I have turned off User Account Control.
- I have run the bat script and Visual Studio as administrator.
- I have edited the registry to enable linked connections, as per this instruction: http://technet.microsoft.com/en-us/library/ee844140%28v=ws.10%29.aspx
None of the methods above worked for me. What did work was to change the path (in my code) from Y: to the explicit C:\Projects... …\Configuration\Files, but that gave rise to other issues and is not a suitable way to solve the problem.
My colleagues have this problem as well and we are running out of ideas. Can you help us?
I’m running Windows 7 Enterprise, SP1. I’m writing my code in Visual Studio Ultimate 2012.