I have an ASP.NET application running on Apache server with mod_mono. If I have a folder called "temp" located in the website's root directory and run the following code
System.IO.TextWriter tw = new System.IO.StreamWriter("temp/test.txt");
tw.WriteLine(DateTime.Now);
tw.Close();
it saves test.txt in C:\Program Files\Mono-2.6.4\bin\temp on the server. If I add a slash to the directory name like this:
System.IO.TextWriter tw = new System.IO.StreamWriter("/temp/test.txt");
It saves it to C:/temp. Both do not do what I want.
How do I get the code to save the file to the temp folder inside my website's root directory? Is this a mod_mono issue or something to do with Apache?
I have tried adding this line to httpd.conf
Alias /temp "C:/Path_to_root_folder/temp"
without any luck. I shouldn't have to use alias if the temp folder is within the root directory, correct?
In my development environment which uses XSP as the web server everything works as expected. It is only a problem when running on Apache.