<%@ Page language="c#" src="EventReviewPage.aspx.cs" AutoEventWireup="false" Inherits="EventReviewPage" %>
<%--
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;
using System.Diagnostics;
public class EventReviewPage : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblResult;
protected System.Web.UI.WebControls.TextBox txtLog;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox txtSource;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button cmdGet;
protected System.Web.UI.WebControls.CheckBox chkAll;
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.cmdGet.Click += new System.EventHandler(this.cmdGet_Click);
this.chkAll.CheckedChanged += new System.EventHandler(this.chkAll_CheckedChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void chkAll_CheckedChanged(object sender, System.EventArgs e)
{
if (chkAll.Checked == true)
{
txtSource.Text = "";
txtSource.Enabled = false;
}
else
{
txtSource.Enabled = true;
}
}
private void cmdGet_Click(object sender, System.EventArgs e)
{
if (!EventLog.Exists(txtLog.Text))
{
lblResult.Text = "The event log " + txtLog.Text ;
lblResult.Text += " doesn't exist.";
}
else
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
EventLog log = new EventLog(txtLog.Text);
foreach (EventLogEntry entry in log.Entries)
{
// Write the event entries to the page.
if (chkAll.Checked == true ||
entry.Source == txtSource.Text)
{
sb.Append("Entry Type: ");
sb.Append(entry.EntryType.ToString());
sb.Append("
Message: ");
sb.Append(entry.Message);
sb.Append("
Time Generated: ");
sb.Append(entry.TimeGenerated);
sb.Append("
");
}
lblResult.Text = sb.ToString();
}
}
}
}
--%>