Why am I getting Access Denied when writing files to a network path when my user account can create files

System.IO.File.WriteAllBytes(NetworkPath, Encoding.UTF8.GetBytes(stringBuilder.ToString())); 

When running this code in Visual Studio, I get Access Denied.

However if I navigate to Network Path with File Explorer, I can right click and create Files and Folders with the same User account that is running Visual Studio 2019 and the code above.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum