0

The application I am building relies on access to a mapped network drive. Let's call it "P:\". For the sake of this question let's assume that all users have this drive mapped. All users can access this drive through windows explorer. All users have identical folder structures in P:\, but the shared folder that they link this drive to is locally random. However when they run the program it becomes obvious that in some cases that something went wrong with user privileges/drive setup. For some, the following code:

List<string> dirs = new List<string>(Directory.GetDirectories("P:\\"));

would return an empty list, or a complaint that "P:\" simply does not exist. The question is: is it possible to correctly, automatically resolve the correct privileges needed to work correctly with P:\ drive and carry on without having the users to go through re-configuring the mapping?

  • do you mean you want to map the drive if the drive not exist? – Prisoner Jul 07 '14 at 09:20
  • No, not ideally. I know the drive exists one way or another on some user account in some way. I need to resolve that and put my application inline with those credentials to work unobstructed with the drive as if nothing happened. – hephaestus Jul 07 '14 at 09:31
  • Or is the only way to check if the drive can be found and if not, ask the user where the local folder is and map it on the run? – hephaestus Jul 07 '14 at 09:36
  • yea, otherwise, you may try to `impersonation`, but I don't think this is a wise option – Prisoner Jul 07 '14 at 09:42

0 Answers0