From the course: ASP.NET Web Forms Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Tracing from code

Tracing from code - ASP.NET Tutorial

From the course: ASP.NET Web Forms Essential Training

Start my 1-month free trial

Tracing from code

- So, so far we've seen how we can add actually tracing for our application. But let's see how we can do actually a lab trace from our code. And it's a very simple way of doing that. We have an object called Trace and that trace object has a method called Write. The method has actually three different overloads but one that it's very interesting for us is actually this one where we have a category. So the category would be "From code" and then another one would be the message that we want to convey. So we are going to say this is a no postback. The name of the category could be whatever you want so we are not actually bound to use the name "From code" or whatever. I just chose this name because it made a little bit more sense. And then I can see here, we have a Postback, and then I can add the txtData.Text, txtData.Text as the data so I get to see exactly what is on the screen. So let us do like this. Now if we run the application again, and we do a Postback with a Hello World and I…

Contents