Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying TRACE data

ASP.Net Troubleshooting

Displaying TRACE data

by  putrtek  Posted    (Edited  )
I Complied this tip from several places on the Internet

Add this code to the very beginning of your Page Load event...
Code:
If Request.QueryString("trace") = "true" Then
    Trace.IsEnabled = True
End If

Then add

Code:
&trace=true

To the end of your URL when ever you want to get TRACE information


Here is a addon to this...

If you are updating data and want to see what paremeters are being passed to your Stored procedure

Add this proc to the code behind file
Code:
      Protected Sub SqlDataSource_Insert_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource_Insert.Inserting
        For x As Integer = 0 To e.Command.Parameters.Count - 1
            Trace.Write(e.Command.Parameters(x).ParameterName)
            Trace.Write(e.Command.Parameters(x).Value)
        Next
    End Sub

This proc assumes your data source is called 'SqlDataSource_Insert' change this is it's not.

This proc combined with the '&trace=true ' from above will write out all the parameters being passed by your page to the TRACE

Pretty cool...
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top