Hello, I am attempting to write to log files on my site with no success. My code is as follows: LogPath = System.Web.HttpContext.Current.Server.MapPath("~/faresharkbe/App_Data/Logs/" & GetLogPath(LogType)) Dim objStreamWriter As StreamWriter Try objStreamWriter = File.AppendText(LogPath) objStreamWriter.WriteLine(System.DateTime.Now & " " & "test") Catch ex As Exception Finally If Not objStreamWriter Is Nothing Then objStreamWriter.Close() End If End Try Doing some debugging, the logpath variable is: E:\web\faresharkbe\htdocs\faresharkbe\App_Data\Logs\Daemon\log.txt This is the correct server path according to DASP support. This code does work on my local server. If I go to the app_data\logs\daemon directory for my site, however, there is never a log file there. Can anyone help?
Figured it out I found another post and reailzed it is the App_Data directory that is causing the permissions issue. I created a "logs" directory and wrote the logs to this location and things seem to work now. So the syntax to get to this directory is: Server.MapPath("~/Logs/yourtempfile.txt")
Thanks for posting the solution. The App_data cannot be really access by applications for security reasons I believe.