File: Global.asax
<%@ Application Language="C#" Inherits="Global" %>
File:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class Global : System.Web.HttpApplication
{
public static int successRate = 50;
protected void Application_Start(Object sender, EventArgs e)
{
WriteFile("Application Starting");
}
protected void Application_End(Object sender, EventArgs e)
{
WriteFile("Application Ending");
}
public void WriteFile(string strText)
{
System.IO.StreamWriter writer = new System.IO.StreamWriter(@"C:\Data.txt", true);
string str;
str = DateTime.Now.ToString() + " " + strText;
writer.WriteLine(str);
writer.Close();
}
public static void StaticWriteFile(string strText)
{
System.IO.StreamWriter writer = new System.IO.StreamWriter(@"C:\Data.txt", true);
string str;
str = DateTime.Now.ToString() + " " + strText;
writer.WriteLine(str);
writer.Close();
}
}
9.26.HttpApplication |
| 9.26.1. | Extends System.Web.HttpApplication |