문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top