I am trying to create a file on the remote machine but I am getting this error:
The network name cannot be found
I checked the network path and I was able to access the path from my machine. Could you please let me know what could be wrong?
Here is my code:
using (StreamWriter sw = new StreamWriter("\\\\servername\\TEST1\\TEST\\NEWFILE.csv", true)) {
sw.WriteLine(sw);
}
Go to \\servername\TEST1 and give write permission to the user or ASP.NET (if you have a web application) on the test folder and then re-run your program, and it will work.
To give write permissions, just refer to this article:
How to share a folder/File
In case it still does not work, try replacing the server name with the server IP address and do the same as stated above.
Give the access rights to the user under which this application runs either it is a IIS pool or windows service etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With