[Mono-list] Global.asax problem with Mono 0.30

Tracy Barlow tracy@aic.net.au
Thu, 26 Feb 2004 22:12:12 +1000


I have an ASP.NET application that has code in Global.asax, in the 
Session_Start Method, this code runs fine under Mono 0.29 and mod-mono 
0.6, it does not run at all under Mono 0.30 and mod-mono 0.7.

below is a test app that will demonstrate what I am saying (I hope).

Class1.cs

using System;

namespace globalasaxtest
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    public class Class1
    {
        private string _Message;

        public Class1()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public string Message
        {
            get
            {
                return _Message;
            }
            set
            {
                _Message = value;
            }
        }
    }
}

Global.asax

<%@ Application Codebehind="Global.asax.cs" 
Inherits="globalasaxtest.Global" %>

Global.asax.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;

namespace globalasaxtest
{
    /// <summary>
    /// Summary description for Global.
    /// </summary>
    public class Global : System.Web.HttpApplication
    {
        public Global()
        {
            InitializeComponent();
        }

        protected void Application_Start(Object sender, EventArgs e)
        {

        }

        protected void Session_Start(Object sender, EventArgs e)
        {
            Class1 message = new Class1();
            message.Message = "Must be running under Mono 0.29";
            HttpContext.Current.Session["Message"] = message;
        }

        protected void Application_BeginRequest(Object sender, EventArgs e)
        {

        }

        protected void Application_EndRequest(Object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(Object sender, 
EventArgs e)
        {

        }

        protected void Application_Error(Object sender, EventArgs e)
        {

        }

        protected void Session_End(Object sender, EventArgs e)
        {

        }

        protected void Application_End(Object sender, EventArgs e)
        {

        }

        #region Web Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        }
        #endregion
    }
}

WebForm1.aspx

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" 
AutoEventWireup="false" Inherits="globalasaxtest.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
  <head>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema 
content="http://schemas.microsoft.com/intellisense/ie5">
  </head>
  <body MS_POSITIONING="GridLayout">

    <form id="Form1" method="post" runat="server">

    <asp:Label ID="testLabel" Runat="server"></asp:Label>

    </form>

  </body>
</html>

WebForm1.aspx.cs

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;

namespace globalasaxtest
{
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {

        protected System.Web.UI.WebControls.Label testLabel;

        private void Page_Load(object sender, System.EventArgs e)
        {
            Class1 message = (Class1)HttpContext.Current.Session["Message"];
            if (message != null)
            {
                testLabel.Text = message.Message;
            }
            else
            {
                testLabel.Text = "Looks like we are running under Mono 
0.30";
            }
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form 
Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {   
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion
    }
}

-- 

Regards

Tracy Barlow

Phone:	07 4124 5092
Mobile:	0146 00 38 61
mail:	tracy@aic.net.au
Website:www.tracyannesoftware.com