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 %
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN 
HTML
HEAD
titleSession/title
meta name=GENERATOR Content=Microsoft Visual Studio .NET 7.1
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
form id=Form1 method=post runat=server
PFONT color=#ff size=5STRONGApplication y 
Session/STRONG/FONT/P
PNumero de accesos:
asp:Label id=lblContador 
runat=server/asp:Label/P
P
asp:Button id=btnContador runat=server 
Text=Incrementa el contador/asp:Button/P
PFONT color=#cc66cc 
size=5STRONGAutenticacion/STRONG/FONT/P
PNombre:
asp:TextBox id=txtNombre 
runat=server/asp:TextBox/P
PClave:
asp:TextBox id=txtClave 
runat=server/asp:TextBox/P
P
asp:Button id=btnCrea runat=server Text=Crear 
sesion/asp:Buttonnbsp;
asp:Button id=btnLee runat=server Text=Leer 
sesion/asp:Button
asp:Button id=btnAbandona runat=server 
Text=Abandonar sesion/asp:Button/P
P
asp:Label id=lblSesion 
runat=server/asp:Label/P
P
asp:HyperLink id=HyperLink1 runat=server 
ImageUrl=VerificaSession.aspxVerifica Sesion/asp:HyperLink/P
Pnbsp;/P
/form
/body
/HTML
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
{
/// summary
/// Descripción breve de Session.
/// /summary
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());