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
6 3577
What's the value of session.session ID? The thing that you have to think of in this situation is, I've got a problem how can I debug it? 1st POC the line that throws the exception, then work backwards. HTH.
Plater 7,872
Recognized Expert Expert
Did .net1.1 applications not have a Session object built in to use?
What's the value of session.session ID? The thing that you have to think of in this situation is, I've got a problem how can I debug it? 1st POC the line that throws the exception, then work backwards. HTH.
Thanks for the advice. SessionID is an alphanumeric value. Both the key and value I'm trying to insert are alphanumeric actually. It seems like the login.aspx cannot find the Global.SessionT ableSync hashtable. I am very confused because other items (int and string) are accessible using Global.variable name. What is POC?
-Nick
Did .net1.1 applications not have a Session object built in to use?
There is a Session Object in .Net 1.1.
Plater 7,872
Recognized Expert Expert
So then I am confused, why do you appear to be implementing your own?
Gotcha, I want to store all active sessions and associated userids in a hashtable. When Session_End, I delete the key and userid value. Session_Start occurs before the login.aspx is posted back to the server.
-Nick
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Szymon Madejczyk |
last post by:
example code:
public class envtest
{
public static void Main()
{
System.Diagnostics.Process proc =
System.Diagnostics.Process.GetCurrentProcess();
string env = proc.StartInfo.EnvironmentVariables;
}
|
by: Billy Patton |
last post by:
First, I'm not a student looking for help. Although there's nothing wrong
with studens looking for help here.
I'm learning c++ move further away from the perl wars here at
work (my version is better, use it only)
I've had this HashTable written in c that I've used for 10+ years. It works
without any problems. I'm trying to reduce my overall amount of code by using
STL in c++. To make migration easier I've create a class that inherits...
|
by: Jules |
last post by:
I have the following code which isn't working as I expect it to:
---
#include <iostream>
using namespace std;
class mystring
{
public:
mystring (const char * src) { /* ... */ }
|
by: todorov-fkt |
last post by:
Hello,
I have packed a few images into resources files and compiled those files
into a resource dll. The dll has a static function that returns all of the
images. When I try to use the function in an application I get the following
exception (in translation from German):
"A not handled exception of type
'System.Resources.MissingManifestResourceException' occured in mscorlib.dll
|
by: Wee Bubba |
last post by:
i have a class. within the constructor for this class it tests if 2
session objects exist and if they dont it creates them. this is a one
off deal. The session objects are both Hashtables.
afterwards the class is reinstantiated on a different page. i am then
calling a method on this class. I basically want to retrieve one of
the Hashtables from the session, clear it, then add a key/value to
it. But for some reason i cant understand it is...
| |
by: GTi |
last post by:
If I use:
ArrayList TimeScale = new ArrayList();
TimeScale.Capacity = 1000;
TimeScale="test 1"
The last line trow me an error:
Index was out of range. Must be non-negative and less than the size of
the collection.
Parameter name: index
|
by: Extremest |
last post by:
I have a loop that is set to run as long as the arraylist is > 0.
at the beginning of this loop I grab the first object and then
remove it. I then go into another loop that checks to see if there
are more objects that match the first object that i grabbed. If
they match then I put them in an array. I would like to remove each
match from the arraylist as I find them to speed things up and so
that they don't get checked again. If I try...
|
by: evaristobo |
last post by:
i'm a bit confused here, a pointer is something aiming to an object,
but a static class is not an object, nevertheless i would like to have
the possibility of doing something like handling an HashTable and
getting from it a pointer to a static class :
( (classStatic)myHash("classStatic") ).staticMethod()
....is this possible, or i'm i short on reading?
|
by: raylopez99 |
last post by:
Hello all—
I’m trying to get the below to work and cannot get the format right.
It’s from this example: http://msdn.microsoft.com/en-us/library/8627sbea(VS.71).aspx
What it is: I’m trying to store multicast delegates in a hash table,
and then fire the delegates one of two ways (after registering/
creating the delegates, etc).
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |