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

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
 
C

Craig Deelsnyder

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.
 
M

Marty U.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,172
Latest member
NFTPRrAgenncy
Top