C
Chris Peeters
Hi,
How do you use a global application class as in ASP.NET 1.0 ?
I try to use the following Global-class but it doesn't work at all:
In Global.asax:
<%@ Application Language="C#" CodeBehind="Global.asax.cs"
Inherits="Global" %>
In Global.asax.cs:
public partial class Global : System.Web.HttpApplication
{
static string LOGFILENAME = @"c:\temp\cslog.txt";
protected void Application_Start(object sender, EventArgs e)
{
StreamWriter sw = new StreamWriter(LOGFILENAME, bAppend);
sw.WriteLine("Application_Start");
sw.Close();
}
}
When starting up, Application_Start() is not invoked at all!
(Know that the code generates no compiler error)
I know that one way to make things work is to put the event handlers in
a <script> - tag directly in Global.asax,
but i want to put the code in a class. it gives more possibillities.
So, just how can you make a global-class work ?
thank you
Chris
How do you use a global application class as in ASP.NET 1.0 ?
I try to use the following Global-class but it doesn't work at all:
In Global.asax:
<%@ Application Language="C#" CodeBehind="Global.asax.cs"
Inherits="Global" %>
In Global.asax.cs:
public partial class Global : System.Web.HttpApplication
{
static string LOGFILENAME = @"c:\temp\cslog.txt";
protected void Application_Start(object sender, EventArgs e)
{
StreamWriter sw = new StreamWriter(LOGFILENAME, bAppend);
sw.WriteLine("Application_Start");
sw.Close();
}
}
When starting up, Application_Start() is not invoked at all!
(Know that the code generates no compiler error)
I know that one way to make things work is to put the event handlers in
a <script> - tag directly in Global.asax,
but i want to put the code in a class. it gives more possibillities.
So, just how can you make a global-class work ?
thank you
Chris