I am writing some code to access directories and index the files it finds. The user is able to enter a UNC path and impersonate another user to get access to that directory. I am using Directory.Exists to see if the path they have entered is valid before trying to access it.
This works fine for local paths, but when trying to access a UNC path that I know I don't have access to, Directory.Exists is returning true.
My understanding is then that Directory.Exists does not check if the particular path can be "accessed" just that it exists or not.
What else can I use to check if a directory exists and I have read access to it ?
I don't know any of the file names inside the directory at this point.
Thanks!