I'm using Directory.Exists(<path>)
to check if a network/mapped drive is currently connected. I'm using the UNC Path which I get by reading the system's registry.
This works perfectly fine if I run my code through Visual Studio (it tells me that the directory does exist), but, it fails whenever I run the exact same code as a Windows service. I've checked the username and password of the service and it is the proper one needed - everything checks out.
I've also noticed that running Visual Studio as an admin return false while running as a normal user returns true. Does anyone have any idea as to what exactly is going on? I'm trying to get my program to behave the same whether I run it from Visual Studio or as a Windows service.