Writeable file in the application directory

Discussion in 'ASP.NET / ASP.NET Core' started by rlangham, Jul 7, 2010.

  1. I am trying to write a log file from the ASP.NET web application. I find the path to the file using...

    string traceFile = Server.MapPath("~/traceFile.log");

    I then use a FileStream to write to the file, but it appears it is not working.

    Not sure if it a permission issue or what. I saw a post regarding setting permissions for the user, but in my Control Panel it wasn't clear how to do this and what user.

    Any steps on how to write to a file to the server disk?
     
  2. I got things working now, I am writing a file to a directory that is accessible to all users (e.g. anonymous users using web.config). Possibly this is all that was required. My previous attempt was in a directory for only authenticated users. I didn't really think this was required since the web application would be running under the context of a system or some other account.
     
  3. mjp

    mjp

    Sounds good, glad you got it working.
     

Share This Page