[Mono-devel-list] Session and Application Variables in XSP

Cezar Nasui cezar.nasui at polymtl.ca
Thu Oct 9 19:01:11 EDT 2003


And Reply to my message :-)
I add the code maybe a more trained eye could see the mistake

global.asax
------
<%@ Application language="C#" %>

<script runat="server">

    public static String strAppVar = "Application variable";
    public static String strSessVar = "Session variable";

    public void Application_Start(Object sender, EventArgs e) {
        // Code that runs on application startup

        Application["appVar"] = strAppVar;
    }

    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
        Session["sessVar"] = strSessVar;
    }

    public void Session_End(Object sender, EventArgs e) {
        // Code that runs when a session ends
    }

</script>
-----------

index.aspx
-------------
<%@ Page Language="C#" %>
<script runat="server">

    String strAppPage;
    String strVarPage;

    private void Page_Load(){
        strAppPage = (String) Application["appVar"];
        strVarPage = (String) Session["sessVar"];
    }

</script>
<html>
<head>
</head>
<body>
    <p>Application Variable :
    <% Response.Write(strAppPage); %>
    <p>Session Variable :
    <% Response.Write(strVarPage); %>

    <form runat="server">
        <!-- Insert content here -->
    </form>
</body>
</html>


-----Original Message-----
From: Cezar Nasui [mailto:cezar.nasui at polymtl.ca]
Sent: Thursday, October 09, 2003 6:26 PM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-devel-list] Session and Application Variables in XSP


Hi,

I tried a simple example in XSP, to set and App and a Session variable in
global.asax and to display them in index.apx.
The problem is I never get the values in aspx page.
I tried the same code with WebMatrix, with their web server (Cassini I
think) and under IIS and it's working fine.
With XSP I installed the files under test folder, I checked the permissions
as I thought it might be a problem with them but no luck.

Am I missing something ?

Any help really appreciated,

Cezar
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 10/6/2003
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031009/34d30391/attachment.html 


More information about the Mono-devel-list mailing list