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

Tracing from Class in ASP.net application

P: n/a
Hi, I have a C# class that is being used by an ASP.net application. How can
I include the tracing from the class in the ASP.net application's trace
output (trace.axd)?
Jan 21 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
asapjim,

You can get the current HttpContext through the static Current property
on the HttpContext. Once you have the HttpContext instance, you can use the
Trace property on the HttpContext to access the same TraceContext instance
that a Page would return.

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

"asapjim" <as*****@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Hi, I have a C# class that is being used by an ASP.net application. How
can
I include the tracing from the class in the ASP.net application's trace
output (trace.axd)?

Jan 21 '06 #2

P: n/a
Nicholas, thanks for the reply. I got your suggestion to work on a class
instantiated by a Page. However, my class is a Singelton that is created in
Global.asax.cs in the Application_Start event. The Tracing output from the
Singleton class doesn't go anywhere.

"Nicholas Paldino [.NET/C# MVP]" wrote:
asapjim,

You can get the current HttpContext through the static Current property
on the HttpContext. Once you have the HttpContext instance, you can use the
Trace property on the HttpContext to access the same TraceContext instance
that a Page would return.

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

"asapjim" <as*****@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Hi, I have a C# class that is being used by an ASP.net application. How
can
I include the tracing from the class in the ASP.net application's trace
output (trace.axd)?


Jan 22 '06 #3

P: n/a
In this case, you can not store the trace context at the class level.
You need to retrieve it in every call that the object makes.

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

"asapjim" <as*****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
Nicholas, thanks for the reply. I got your suggestion to work on a class
instantiated by a Page. However, my class is a Singelton that is created
in
Global.asax.cs in the Application_Start event. The Tracing output from
the
Singleton class doesn't go anywhere.

"Nicholas Paldino [.NET/C# MVP]" wrote:
asapjim,

You can get the current HttpContext through the static Current
property
on the HttpContext. Once you have the HttpContext instance, you can use
the
Trace property on the HttpContext to access the same TraceContext
instance
that a Page would return.

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

"asapjim" <as*****@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
> Hi, I have a C# class that is being used by an ASP.net application.
> How
> can
> I include the tracing from the class in the ASP.net application's trace
> output (trace.axd)?


Jan 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.