[Mono-bugs] [Bug 49652][Nor] New - ClassName directive in Global.asax ignored

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 14 Oct 2003 15:55:16 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by cezar@cbnmedia.com.

http://bugzilla.ximian.com/show_bug.cgi?id=49652

--- shadow/49652	2003-10-14 15:55:15.000000000 -0400
+++ shadow/49652.tmp.13476	2003-10-14 15:55:16.000000000 -0400
@@ -0,0 +1,112 @@
+Bug#: 49652
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: cezar@cbnmedia.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: ClassName directive in Global.asax ignored
+
+Description of Problem:
+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. 
+Mono returns a "type not found" error.
+
+Steps to reproduce the problem:
+1. Add ClassName="Global" in the global.asax's Application directive
+2. Set some static or non-static variables or methods
+3. Call the methods in an aspx page according to the type
+(you might what to do a Global gl = new Global() for the instance 
+variables and methods, please see the example)
+
+Actual Results:
+Mono returns 
+>>error CS0246: Cannot find type "Global"
+
+Expected Results:
+It should return the values stored in variables or methods
+
+How often does this happen? 
+Every time
+
+Additional Information:
+I'm not sure if it is related or not but you might want to check if 
+CodeBehind classes for Global are picked up Global.asax.cs or 
+Global.asax.vb. My test showed that doesn't but the 2 might be related.
+
+The following code was tested under Windows and is running fine.
+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>
+------------------