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.txtwill 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.txtbeing written to the ICOM folder of your application environment’s root directory.