471,354 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Tracing from Class in ASP.net application

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
3 1180
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
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
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.

Similar topics

2 posts views Thread by Richard | last post: by
5 posts views Thread by Dabbler | last post: by
2 posts views Thread by deepukutty | last post: by
reply views Thread by cnys | last post: by
reply views Thread by rehto | last post: by
2 posts views Thread by bonk | last post: by
reply views Thread by Rick | last post: by
1 post views Thread by RedLars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.