I've an ASP.Internet application running on Apache server with mod_mono. If I've got a folder known as "temp" situated within the website's root directory and run the next 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 FilesMono-2.6.4bintemp around the server. Basically give a slash towards the directory title such as this:

System.IO.TextWriter tw = new System.IO.StreamWriter("/temp/test.txt");

It saves it to C:/temp. Both don't do things i want.

How do you obtain the code in order to save the file towards the temp folder within my website's root directory? Is a mod_mono problem or something like that related to Apache?

I've attempted adding this line to httpd.conf

Alias /temp "C:/Path_to_root_folder/temp"

with no luck. I should not need to use alias when the temp folder is at the main directory, correct?

During my development atmosphere which utilizes XSP because the web server everything works not surprisingly. It is simply an issue when running on Apache.

Try:

string filename = Server.MapPath("~/temp/test.txt");
using (TextWriter tw = new StreamWriter(filename))
{

}