am using Visual Studio 2003, .Net Framework 1.1, C#. I get a SystemNullRefer enceException when trying to do a hashtable.add(s tring,string) from a login page, and I do not understand why because all of the other data items from the Global.asax.cs are accessible in my pages. The key and value are not null (according to the watch window), so it is something else. This is likely something retarded, so I apologize in advance. It is my first attempt at a hash table. I am trying to store userid and sessionid for logging, statistics, troubleshooting (lol), etcetera.
Code Snippit from Global.asax.cs
public class Global : System.Web.Http Application
{
private System.Componen tModel.IContain er components = null;
public static string DatabaseConnect ionString;
public static int NumberOfConnect ions;
public static int TotalConnection sServiced;
public static DateTime DateStarted;
public static int FailedLoginAtte mpts;
public static int SuccessfulLogin Attempts;
public static string ErrorLogFile;
public static int TotalPagesServe d;
public static Hashtable SessionTable;
public static Hashtable SessionTableSyn c;
public Global()
{
InitializeCompo nent();
DatabaseConnect ionString=(stri ng ) System.Configur ation.Configura tionSettings.Ap pSettings["DBNameAndP ath"];
NumberOfConnect ions=0;
TotalConnection sServiced=0;
FailedLoginAtte mpts=0;
SuccessfulLogin Attempts=0;
ErrorLogFile=(s tring ) System.Configur ation.Configura tionSettings.Ap pSettings["ErrorLogFi le"];
TotalPagesServe d=0;
DateStarted=Sys tem.DateTime.No w;
Hashtable SessionTable = new Hashtable();
Hashtable SessionTableSyn c = Hashtable.Synch ronized(Session Table);
Code Snippit from login.aspx----------------------------------------------------------------------------
Session.Add("Us erID",sUserid);
Session.Add("Fu llName",sFullna me);
Global.Successf ulLoginAttempts ++;
//System.NullRefe renceException on the next line
Global.SessionT ableSync.Add(sU serid,Session.S essionID); //tried with .ToString() also
I'm not trying to be dense, but I do have more of a procedural background than OO.
Thanks in advance,
Nick
Code Snippit from Global.asax.cs
public class Global : System.Web.Http Application
{
private System.Componen tModel.IContain er components = null;
public static string DatabaseConnect ionString;
public static int NumberOfConnect ions;
public static int TotalConnection sServiced;
public static DateTime DateStarted;
public static int FailedLoginAtte mpts;
public static int SuccessfulLogin Attempts;
public static string ErrorLogFile;
public static int TotalPagesServe d;
public static Hashtable SessionTable;
public static Hashtable SessionTableSyn c;
public Global()
{
InitializeCompo nent();
DatabaseConnect ionString=(stri ng ) System.Configur ation.Configura tionSettings.Ap pSettings["DBNameAndP ath"];
NumberOfConnect ions=0;
TotalConnection sServiced=0;
FailedLoginAtte mpts=0;
SuccessfulLogin Attempts=0;
ErrorLogFile=(s tring ) System.Configur ation.Configura tionSettings.Ap pSettings["ErrorLogFi le"];
TotalPagesServe d=0;
DateStarted=Sys tem.DateTime.No w;
Hashtable SessionTable = new Hashtable();
Hashtable SessionTableSyn c = Hashtable.Synch ronized(Session Table);
Code Snippit from login.aspx----------------------------------------------------------------------------
Session.Add("Us erID",sUserid);
Session.Add("Fu llName",sFullna me);
Global.Successf ulLoginAttempts ++;
//System.NullRefe renceException on the next line
Global.SessionT ableSync.Add(sU serid,Session.S essionID); //tried with .ToString() also
I'm not trying to be dense, but I do have more of a procedural background than OO.
Thanks in advance,
Nick
Comment