Frage

I'm just putting together a little POC project, and I'm having some weird issues with file permissions. All I'm trying to do right now is:

if (!File.Exists(Path.Combine(path,"Schedule.txt")))
            {
                File.Create(path);
                Debug.WriteLine("Schedule File Created.");
            }

And I'm getting: "Access to the path "BlahBlahBlahMyPathWouldGoHere" is denied." The path is: "C:\Users\MyUser\My Documents\TestStuff".

But I already set the permissions so that the built-in "Everyone" user has all permissions on that folder and all child folders. So, what gives?

My company uses ViewFinity Agent to selfishly and ingloriously strip away any possibility of anyone being productive, so maybe that's part of the issue. I don't know. I haven't had a lot of trouble with this kind of thing before.

Anybody know of any other possible causes of this issue?

War es hilfreich?

Lösung

Oh, I'm dumb.

 File.Create(path);

should have been:

 File.Create(Path.Combine(path,"Schedule.txt"));

So I was trying to create a file in the same location as a folder. Silly me :)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top