Logging to file from an asp.net application: how to???

  • Thread starter Thread starter Bob Rock
  • Start date Start date
B

Bob Rock

Hello,

I'd like to log to a file from an asp.net application but it seems that the
user under which asp.net applications run has very limited permissions.
Apart giving the user greater permissions, is there any other solution to
allow logging to file system???

Also I'd like to write to the bin or root asp.net application folder, how do
I get this folder dynamically from the application itself???

Bob Rock
 
Hello,

I'd like to log to a file from an asp.net application but it seems that
the
user under which asp.net applications run has very limited permissions.
Apart giving the user greater permissions, is there any other solution to
allow logging to file system???

Also I'd like to write to the bin or root asp.net application folder,
how do
I get this folder dynamically from the application itself???

Bob Rock

Either write to one of your web app's folders (recommended), or give the
aspnet user write access to whatever folder you are going to write to. To
find a local folder's path, use Server.MapPath("./bin"), etc.

May I also recommend using log4net for logging? It's synonymous to Java's
log4j, and works pretty well OOTB. So you don't have to write a bunch of
logging infrastructure.
 
Bob said:
Hello,

I'd like to log to a file from an asp.net application but it seems that the
user under which asp.net applications run has very limited permissions.
Apart giving the user greater permissions, is there any other solution to
allow logging to file system???

Also I'd like to write to the bin or root asp.net application folder, how do
I get this folder dynamically from the application itself???

Bob Rock
To get the virtual root path try HttpRequest.ApplicationPath this will
provide the http:// path and not the d:\InetPub\wwwroot\myapplication.

You may also try Request.ApplicationPath it has been a few days since I
did this and I'm not for sure which I used!:-)


Marty U.
 
Back
Top