0

(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:

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.

0

It seems that the mapping of the drive is connected to the user performing the mapping. When impersonating another user, the mapping no longer exists. What we did to solve the problem was to add a statement, right after the impersonation, to perform the mapping once again (but this time it was the impersonated user performing the mapping).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.