473,513 Members | 2,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1262
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1682
by: Trace User | last post by:
Hello, I have a design question regarding Tracing and Trace Switches. I understand that Trace Switches can be configured through an application's .config file. When a switch is instantiated, the application automatically checks the configuration file for a matching named switch. If there's a match, the configuration parameters are set.
2
1196
by: Richard | last post by:
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? ...
5
1566
by: Dabbler | last post by:
When I first start up an ASP.NET application with tracing enabled in web.config the first few pages show trace at bottom of the page but then at some point the pages return to normal with no trace information displayed. Can anyone tell me what might be causing the Trace to turn off? Thanks for any help with this ..NET 1.1 running on...
2
1749
by: deepukutty | last post by:
Hi all, I know tht we can do tracing in two ways.one in application level and the other is at Page level. I am able to see the details of trace either on the page itself or .../trace.axd page. I want to use maximum out of the available trace details . or let me put it like this.... tell me the actual scenario's where these trace details...
0
1348
by: cnys | last post by:
We have an ASP.NET 2.0 (C#) app and we're trying to add tracing into it. The tracing functionality within .NET is great, but when we output this to a file, it's kind of sparse. So, we're looking for ideas on how to get more tracing info. output to our log file than what's currently output by calling the Write methods. Here are some...
0
1317
by: rehto | last post by:
We have an ASP.NET 2.0 (C#) app and we want to enable tracing (see the code snippets below). The first time a user navigates to the app., the tracing works fine (the ASP.NET tracing appears on the screen and writes to a text file). The problem happens any subsequent time the app. is used--tracing doesn't happen. It's as if tracing just...
2
1246
by: bonk | last post by:
I am using .NET 2.0 tracing to log messages within my application and app.config (<System.Diagnostics>) to configure it. I would like to be able to configure tracing in a finer grained manner than it is currently possibile out of the box. Especially I would like 1. the filnames where the traceevent end up to be dynamically generated (e.g....
0
977
by: Rick | last post by:
I'm trying to implement application tracing for a single session but am not having much luck. I'd like to isolate TraceContext application level messages for a single session and have them logged to trace.axd (or even a file). The TraceContext class is sealed and exposes no useful events so it's pretty uncooperative. I have also been looking...
1
1703
by: RedLars | last post by:
Hi Does the class System.Diagnostics.Trace use a singelton ? I'm able to do this; System.Diagnostics.Trace.WriteLine("test"); However, these give compiler errors; System.Diagnostics.Trace myTrace = new System.Diagnostics.Trace; // A new expression requires () or
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7565
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5704
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4759
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3255
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.