I am trying to develop an asp application(my asp solution is in c:\inetpub). i need a logger. So I create inside my solution a folder Logs and I try to save there a *.log file:
using (FileStream fs = File.Create(logPath))
{...}
// logpath = Server.MapPath(@"~\Logs") + Path.DirectorySeparatorChar + logName
// so: logpath = C:\\inetpub\\wwwroot\\MyApplication\\Logs\\MyLog.log
I get the error:
Access to the path 'C:\inetpub\wwwroot\MyApplication\Logs\MyLog.log' is denied.
Is there a solution for this? I need that the installer to be able to provide acces to inetpub... I am asking also if is this the wrong way to create a log? Maybe exist a pattern used for that ...? Thank you