Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Debug.WriteLine and Trace.WriteLine from class.

Reply
Thread Tools

Debug.WriteLine and Trace.WriteLine from class.

 
 
xxx@hotmail.com
Guest
Posts: n/a
 
      09-01-2005
Hi,

I have written a class, which I instanciate from the code-behind of an
aspx page. I want to output some items to the debugger from within the
class, but Debug.WriteLine and Trace.WriteLine don't seem to do
anything. Where am I going wrong?

Thanks

 
Reply With Quote
 
 
 
 
john_teague
Guest
Posts: n/a
 
      09-01-2005
You can get to the Trace class in your class using HttpContext.Current.
HttpContext.Current.Trace.Write("Your message here");

HttpContext is basically everything from a Http request. Everything is
here. the Page class members like Request, Response, Cache, etc.. are
actually calling HttpContext members.

HttpContext.Current is a Singleton of the the current http request, so
you cannot not create a new HttpContext yourself. You must use the
Current property.

Hope this helps,
John Teague

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57