Please help me with this, I have gotten nowhere and have spent a lot of
effort. I have a problem with session level variables not working.
Consider the two files, page1.aspx and page2.aspx. The line highlighted
with the * throws an exception ?Object reference not set to an instance of
an object.? Below that, I have two lines, commented out, which do work if
the offending line is commented out.
// CONTENTS OF PAGE1.ASPX
<%@ Page Language="C#" Debug="true" EnableSessionState="True"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script Language="c#" runat="server">
public void Page_Load()
{
Session["RootDirectory"] = ?test?;
Response.Redirect("http://localhost/ksave/page2.aspx"); }
//CONTENTS OF PAGE2.ASPX
<%@ Page Language="C#" Debug="true" EnableSessionState="True"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.IO" %>
<script Language="c#" runat="server">
public void Page_Load()
{
// * The next line throws an exception
diagnosticlabel.Text=Session["RootDirectory"].ToString();
//But these lines will run if the above is commented out.
Session["RootDirectory"]="test";
diagnosticlabel.Text=Session["RootDirectory"].ToString();
}