[Mono-devel-list] Global.asax changes
Cezar Nasui
cezar.nasui at polymtl.ca
Mon Oct 13 13:47:51 EDT 2003
It seems there is another problem with global.asax.
Adding ClassName at the Application's Directive tells ASP.NET to name the
class it generates for global.asax. This name can be used later in the aspx
pages to refer global variables and methods, static or not. I run this code
under Win (WebMatrix and IIS) and it's working fine. With Mono / xsp I get :
>>error CS0246: Cannot find type "Global"
Here are the files I used for testing:
---global.asax---
<%@ Application language="C#" ClassName="Global" %>
<script runat="server">
public static String strStatic = "Static String Variable";
public void Application_Start(Object sender, EventArgs e) {
// Code that runs on application startup
}
public void Application_End(Object sender, EventArgs e) {
// Code that runs on application shutdown
}
public void Application_Error(Object sender, EventArgs e) {
// Code that runs when an unhandled error occurs
}
public void Session_Start(Object sender, EventArgs e) {
// Code that runs when a new session is started
}
public void Session_End(Object sender, EventArgs e) {
// Code that runs when a session ends
}
public String TestPublicMethod(){
return "String from public method";
}
public static String TestStaticMethod(){
return "String from static method";
}
</script>
----------
---index.aspx-----
<%@ Page Language="C#" %>
<script runat="server">
// Insert page code here
private void Page_Load(){
//
}
Global gl = new Global();
</script>
<html>
<head>
</head>
<body>
<p>Static string variable :
<% Response.Write(Global.strStatic); %>
<p>Test Pubic Method :
<% Response.Write(gl.TestPublicMethod()); %>
<p>Test Static Method :
<% Response.Write(Global.TestStaticMethod()); %>
<form runat="server">
<!-- Insert content here -->
</form>
</body>
</html>
------------------
I'm trying to understand the source code so I can give you more info about
the eventuals errors I get and maybe finally to can patch myself some bugs.
Is it HttpApplicationFactory that I should look now? I don't see any
reference to ClassName parameter of the Application directive...
Cezar
-----Original Message-----
From: Gonzalo Paniagua Javier [mailto:gonzalo at ximian.com]
Sent: Sunday, October 12, 2003 6:15 PM
To: Mono-devel-list at lists. ximian. com
Subject: Re: [Mono-devel-list] Global.asax changes
El dom, 12-10-2003 a las 22:19, Cezar Nasui escribió:
> Hi,
>
> The book I have on ASP.NET says that any modification to the
> Global.asax file are detected by the .NET framework which serves the
> current pending requests and, after finishing them, closes the old
> application domain, it recompiles the global.asax file (or the
> Global.asax.cs or vb), starts a new application domain and any new
> request sees the new version.
>
> I tested on Mono and it doesn't do this thing. Is this a know matter?
> It is a bug?
It's a bug. Please file a bug report so that I don't forget about it.
-Gonzalo
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
More information about the Mono-devel-list
mailing list