What i am trying to do is to Create or writea text file in the server to work as a data log, this code works fine in my pc, but when i build the solution and upload the server files, it creates nothing. Could it be that this code only appends the data and as it doesn't find the file, it doesn't do anything?
string fileName= HttpContext.Current.Server.MapPath("~\\logs.txt");
using (FileStream SourceStream = File.Open(fileName, FileMode.Append))
{
using (StreamWriter file = new StreamWriter(SourceStream))
{
file.WriteLine(data);
}
}
I also checked the server folder permissions and it is ok
Am i missing something? is something wrong? something that could be done better?