Trace in VB.NET

In this article, We will see how to use Trace in VB.NET.
  • 5161

In this article, We will see how to use trace in vb.net.

The Trace:

The trace class is the same class of debugging in .net framework the trace support in an application. The tracing is the help in your application for debugging and bug fixing.

The trace is show run time All Request Details,Trace Information, Control Tree, Session State, Application State, Request Cookies Collection , Response Cookies collection, Headers Collection ,Response Header Collection, Form collection, Query string Collection and Server Variables etc.

Page tracing:-

Page trace is like 'Trace="true/false"' and 'TraceMode="SortByTime/SortByCategory"'.
This is aspx code:-
This type use trace in the aspx page.

<%@ Page Language="VB" AutoEventWireup="false" Trace="true" TraceMode="SortByTime"
    CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<
body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
</body>
</
html>

This is .vb code:-This type use trace in the .vb page.

Partial Class Default2
    Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) _
   Handles MyBase.Load
        If Request.QueryString("trace") = "true" Then
            Trace.IsEnabled = True
        End If
    End Sub
End Class

Application Tracing:-This type use trace in the web.config page:-

<trace enabled="true" requestLimit="50" traceMode="SortByTime" pageOutput="true"/>

1.First of all Request Details and Trace Information:-

Output:-

tracing1.bmp
 

2.Control Tree:-

Output:-

tracing2.bmp
 

3.Session State, Application State, Request Cookies Collection and Response Cookies collection:-

Output:-

tracing3.bmp
 

4.Headers Collection and Response Header Collection:-

Output:-

tracing4.bmp
 

5.Form collection, Query string Collection and Server Variables:-

Output:-

  tracing5.bmp

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.