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" %>
<HTML>
  <body>
    <FORM id="Form1" method="post" runat="server">
      <asp:Label id="Label1" runat="server">A Simple Tracing Example</asp:Label><BR>
      <BR>
      <asp:Button id="cmdTrace" runat="server" Width="104px" Text="Trace"></asp:Button><BR>
      <BR>
    </FORM>
  </body>
</HTML>

<%--
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)
    {
      InitializeComponent();
      base.OnInit(e);
    }
    
    private void InitializeComponent()
    {    
      this.cmdTrace.Click += new System.EventHandler(this.cmdTrace_Click);
      this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion

    private void cmdTrace_Click(object sender, System.EventArgs e)
    {
      Trace.IsEnabled=true;
    }
  }


--%>
           
       








Related examples in the same category

1.Is trace enabled (VB.net)
2.Trace for loop (VB.net)
3.Write to Trace (VB.net)
4.Use Trace to debug (VB.net)
5.Page trace mode (VB.net)
6.Write trace warn (VB.net)
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#)