Debug.WriteLine and Trace.WriteLine from class.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xxx@hotmail.com

    Debug.WriteLine and Trace.WriteLine from class.

    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

  • john_teague

    #2
    Re: Debug.WriteLine and Trace.WriteLine from class.

    You can get to the Trace class in your class using HttpContext.Cur rent.
    HttpContext.Cur rent.Trace.Writ e("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.Cur rent 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

    Comment

    Working...