By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

Tracing Suggestion

P: n/a
Hello,

I have a web application where I am doing alot of the work in a separate
namespace that isn't part of a web page. I would like to be able to trace
into this section of code, but because it's not a 'Page' object the
Page.Trace isn't doable. Does anyone have any suggestions as to how I can
implement tracing in this separate code? Writing to an output file isn't
doable either because our customers will not allow write access to the disk
drive. Any suggestions? Thanks!
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Richard,

You can access the trace yourself. Basically, set a reference to
System.Web.dll, and use the HttpContext class. The static property Current
will give you the current context, and then you can access the Trace
property on that to write to it.

Of course, your app should do nothing if the context is null (in the way
of tracing).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Richard" <ab*******@mindspring.com> wrote in message
news:e%****************@tk2msftngp13.phx.gbl...
Hello,

I have a web application where I am doing alot of the work in a separate
namespace that isn't part of a web page. I would like to be able to trace
into this section of code, but because it's not a 'Page' object the
Page.Trace isn't doable. Does anyone have any suggestions as to how I can
implement tracing in this separate code? Writing to an output file isn't
doable either because our customers will not allow write access to the
disk
drive. Any suggestions? Thanks!

Nov 16 '05 #2

P: n/a
Thanks Nicholas, that worked perfectly!

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
Richard,

You can access the trace yourself. Basically, set a reference to
System.Web.dll, and use the HttpContext class. The static property Current will give you the current context, and then you can access the Trace
property on that to write to it.

Of course, your app should do nothing if the context is null (in the way of tracing).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Richard" <ab*******@mindspring.com> wrote in message
news:e%****************@tk2msftngp13.phx.gbl...
Hello,

I have a web application where I am doing alot of the work in a separate
namespace that isn't part of a web page. I would like to be able to trace into this section of code, but because it's not a 'Page' object the
Page.Trace isn't doable. Does anyone have any suggestions as to how I can implement tracing in this separate code? Writing to an output file isn't doable either because our customers will not allow write access to the
disk
drive. Any suggestions? Thanks!


Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.