I try to create a file in a server using the following code
String path = @"\\192.1.1.55\\d$:\\Scripts\\list.txt";
using (File.Create(path));
richTextBox1.SaveFile(path, RichTextBoxStreamType.PlainText);
It gives System.NotSupportedException The given path's format is not supported.
I also tried
String path = "\\\\192.1.1.55\\d$:\\Scripts\\list.txt";
using (File.Create(path));
richTextBox1.SaveFile(path, RichTextBoxStreamType.PlainText);
I need to create files and access them over the network with the ip of the server that has files,
Share some folder on server, for example Scripts and use this path:
String path = @"\\192.1.1.55\Scripts\list.txt";
Remove the : after the D$ and it should work.
I now realized that you also have an @ at the beginning of the path string, therefore, change the path to this:
String path = @"\\192.1.1.55\d$\Scripts\list.txt";
A better approach would be to map the network path to a drive and to use that while saving.
For instance, map network drive R (for richtextbox) to \\192.1.1.55\d$, then change your path variable to G:\Scripts\list.txt
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