Re: [Mono-list] Global.asax.cs problems; from Visual Studio .NET to Mono/XSP.

2004-04-29 Thread Gonzalo Paniagua Javier
El mié, 28-04-2004 a las 19:01, Roberto Jimeno escribió:
> Hi there!
> 
> I have some code generated using VS.NET. I tried to run that very same
> code using Mono/XSP and I got an error 500
> (System.NullReferenceException) from it. Apparenly this is due to a line
> where `Application["ContadorAccesos"].ToString()' is consulted before it
> is initialized.
> 
> The trick here is that `Application["ContadorAccessos"]' is actually
> initialized in the Global.asax.cs file (set to zero on the method
> "Application_Start" of class "Global". Somehow VS.NET executes the
> initialization prior to the value being consulted, while Mono/XSP does
> not.

You didn't attach the global.asax file to the bug report you entered. If
this is still a bug for you, please, report it using bugzilla and attach
all the files needed to reproduce it.

-Gonzalo


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Global.asax.cs problems; from Visual Studio .NET to Mono/XSP.

2004-04-28 Thread Roberto Jimeno
Hi there!

I have some code generated using VS.NET. I tried to run that very same
code using Mono/XSP and I got an error 500
(System.NullReferenceException) from it. Apparenly this is due to a line
where `Application["ContadorAccesos"].ToString()' is consulted before it
is initialized.

The trick here is that `Application["ContadorAccessos"]' is actually
initialized in the Global.asax.cs file (set to zero on the method
"Application_Start" of class "Global". Somehow VS.NET executes the
initialization prior to the value being consulted, while Mono/XSP does
not.

I have tried stuff like compiling the files in different ways and under
different names; none of them with success. The latest command line I
used was "mcs Global.asax.cs AssemblyInfo.cs Session.aspx.cs
-r:System.Web -r:System.Drawing -r:System.Data -t:library -o
bin/Session.aspx.dll"

The stack trace is shown at the bottom of this message, and the four
related files are attached as well. I hope you can help me understand
how to use the Global.asax(.cs) file(s) and anything else I should know
in order to be able to deploy some of my VS.NET generated code using
Mono/XSP.

Thanks for your help.


Stack Trace:

System.NullReferenceException: Object reference not set to an instance
of an object
in <0x0003d> WebAppLatam.Session:Page_Load (object,System.EventArgs)
in <0x0005a> (wrapper delegate-invoke) 
System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in <0x00090> System.Web.UI.Control:OnLoad (System.EventArgs)
in <0x00033> System.Web.UI.Control:LoadRecursive ()
in <0x0018b> System.Web.UI.Page:InternalProcessRequest ()
in <0x0008d> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)
in <0x00327> ExecuteHandlerState:Execute ()
in <0x0007e> StateMachine:ExecuteState (System.Web.HttpApplication/IStateHandler,bool&)




<%@ Page language="c#" Codebehind="Session.aspx.cs" AutoEventWireup="false" 
Inherits="WebAppLatam.Session" %>



Session



http://schemas.microsoft.com/intellisense/ie5";>



Application y 
Session
Numero de accesos:



Autenticacion
Nombre:

Clave:


 





Verifica Sesion
 



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 WebAppLatam
{
/// 
/// Descripción breve de Session.
/// 
public class Session : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblContador;
protected System.Web.UI.WebControls.Button btnContador;
protected System.Web.UI.WebControls.TextBox txtNombre;
protected System.Web.UI.WebControls.TextBox txtClave;
protected System.Web.UI.WebControls.Button btnCrea;
protected System.Web.UI.WebControls.Button btnLee;
protected System.Web.UI.WebControls.Button btnAbandona;
protected System.Web.UI.WebControls.Label lblSesion;
protected System.Web.UI.WebControls.HyperLink HyperLink1;

private void Page_Load(object sender, System.EventArgs e)
{
//Console.WriteLine(Application["ContadorAccesos"].ToString());
// Introducir aquí el código de usuario para inicializar la 
página
this.lblContador.Text = 
Application["ContadorAccesos"].ToString();
}

#region Código generado por el Diseñador de Web Forms
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: llamada requerida por el Diseñador de Web Forms 
ASP.NET.
//
InitializeComponent();
base.OnInit(e);
}

/// 
/// Método necesario para admitir el Diseñador. No se puede modificar
/// el contenido del método con el editor de código.
/// 
private void InitializeComponent()
{
this.btnContador.Click += new 
System.EventHandler(this.btnContador_Click);