I have a program that fetches a file from a server and downloads it. It is itself located on the server, so to run it you open your browser and type in a URL with parameters.
Now, it runs perfectly fine when the program is located on my machine. However when accessed via your browser it seems to hang. I have tried
MessageBox.Show(username, “Error”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
string[] lines = {"First line", "Second line", "Third line"};
System.IO.File.WriteAllLines(@"C:\Users\Public\TestFolder\WriteLines.txt", lines);
and both of those cause errors when done on the server (but it’s fine when on my own machine).
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Public\TestFolder\WriteLines2.txt"))
file.WriteLine("asfsd");
this seems to hang on the writeline, as the file is created but no content is ever put into the file. Any idea why this is happening or suggestions of things I can put so I know where the problem is?
If I had to guess. Id say you didnt have permissions. Try wrapping everything in an Impersonate statement or give the worker process access to the directory.
Also, make sure the directory exists before writing.