I am working on a site that has both classic ASP and .NET and have found the MSDN "SessionPage" utility to help bridge classic -> .NET session data. I have it up and running fine on my site using the demo code but am having trouble getting it to work with my own pages.
In the demo the test page code is as follows:
<%@ Page Language="C#" Debug="true" Inherits="MSDN.SessionPage" %>
"server">
private void Page_Load(object sender, System.EventArgs e)
{
Session["fName"] = "Billy";
if (Session["Count"] == null) Session["Count"] = "0";
Session["Count"] = Convert.ToString(Convert.ToInt32(Session["Count"]) + 1);
Response.Write(Session["Count"]);
Response.Write("<BR>");
Response.Write(Session["fName"] + " " + Session["lName"]);
}
"-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content=" name="vs_targetSchema">
"Form1" method="post" runat="server">
For my site I want to have access to the Session object in a VB class file, as it holds some general site wide functions that need access to the MSDN Session object. Since this is a class file I don't have a page declaration header, so I figured I could inherit the MSDN.SessionPage class like this:
Imports System.Web
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class TestModules
Inherits MSDN.SessionPage
s_SessionText = Session("TestSessionText")
The error I get is "Object reference not set to an instance of an object." on the s_SessionText = Session("TestSessionText") line... I know this has to be something very dumb that I am missing but I'm pretty new at all of this and just can't figure it out. Anyone have any tips or ideas?
Thanks,
Mike
In the demo the test page code is as follows:
<%@ Page Language="C#" Debug="true" Inherits="MSDN.SessionPage" %>
"server">
private void Page_Load(object sender, System.EventArgs e)
{
Session["fName"] = "Billy";
if (Session["Count"] == null) Session["Count"] = "0";
Session["Count"] = Convert.ToString(Convert.ToInt32(Session["Count"]) + 1);
Response.Write(Session["Count"]);
Response.Write("<BR>");
Response.Write(Session["fName"] + " " + Session["lName"]);
}
"-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content=" name="vs_targetSchema">
"Form1" method="post" runat="server">
For my site I want to have access to the Session object in a VB class file, as it holds some general site wide functions that need access to the MSDN Session object. Since this is a class file I don't have a page declaration header, so I figured I could inherit the MSDN.SessionPage class like this:
Imports System.Web
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class TestModules
Inherits MSDN.SessionPage
s_SessionText = Session("TestSessionText")
The error I get is "Object reference not set to an instance of an object." on the s_SessionText = Session("TestSessionText") line... I know this has to be something very dumb that I am missing but I'm pretty new at all of this and just can't figure it out. Anyone have any tips or ideas?
Thanks,
Mike