Page Trace in code behind (C#) : Trace « Development « ASP.Net

Page Trace in code behind (C#)

<%@ Page language="c#" src="SimpleTrace.aspx.cs" AutoEventWireup="false" Inherits="SimpleTrace" %>
    <FORM id="Form1" method="post" runat="server">
      <asp:Label id="Label1" runat="server">A Simple Tracing Example</asp:Label><BR>
      <asp:Button id="cmdTrace" runat="server" Width="104px" Text="Trace"></asp:Button><BR>

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

  public class SimpleTrace : System.Web.UI.Page
    protected System.Web.UI.WebControls.Label Label1;
    protected System.Web.UI.WebControls.Button cmdTrace;
    private void Page_Load(object sender, System.EventArgs e)

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    private void InitializeComponent()
      this.cmdTrace.Click += new System.EventHandler(this.cmdTrace_Click);
      this.Load += new System.EventHandler(this.Page_Load);


    private void cmdTrace_Click(object sender, System.EventArgs e)


Related examples in the same category

1.Is trace enabled (
2.Trace for loop (
3.Write to Trace (
4.Use Trace to debug (
5.Page trace mode (
6.Write trace warn (
7.Trace asp calendar event (C#)
8.Write debug information to trace log (C#)
9.Page Trace (C#)
10.Write to Trace log in event action (C#)