Is it possible for a web application to write a text file outsite the root folder (like, C:\\test.txt) using the StreamWriter
? I wasn't able to make it work even with full permissions.
string vRegistro = "Some test";
StreamWriter tex = new StreamWriter(@"\\ICOM\public.txt", true, Encoding.UTF8);
tex.WriteLine(vRegistro);
tex.Close();
\\\\ICOM\\public.txt
will be interpreted as a UNC path, since is starts with a double backslash.
It is not a valic UNC at that.
Removing a backslash from the start will result in a file called public.txt
being written to the ICOM folder of your application environment's root directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.