473,320 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Session variable problem

I have a Session object set on Session_Start...
I figured out that the object is never created...
Cannot understand why..

Also I noticed that the debugger will not stop at
breakpoints that are inside the Session_Start method or in
the class of the object that is created within the
Session_Start method...

Is this a bug or a setting problem?
any ideas?
Nov 17 '05 #1
2 3145
I think you might be misunderstanding the message.
The message is probably referring to the Session object
being nothing, not the content.

Session will never bomb out on an object being nothing in
the context you show. Session will be nothing in any
classes you create. Instead,
use "Current.Session.item..." and you should be able to
get your object just fine.

It helps to put a reference to:
System.Web.HttpContext
in your "Imports" in the project properties under the
properties page, Common Properties folder. Otherwise you
need to reference System.Web.HttpContext.Current.Session

Email if you need more...
-----Original Message-----
Ok...

in Global.asax I have:

protected void Session_Start(Object sender, EventArgs e)
{
cms.errorHandler error = new cms.errorHandler();
Session["error"] = error;
}

and then in my code I have:

errorHandler error = (errorHandler)Session["error"];

I get:
Object Reference not set to an instance of an object
(NullReferenceException).

I even get the Exception if I do:

Session["test"] = "Test";

Yes I debug the application
.

Nov 17 '05 #2
I dont understand where to put the reference of
System.Web.HttpContext to. Is there such thing? On my
project properties page there no such thing as "Imports"
under Common Properties. I couldnt find anything like that.
Even in the code if I do "using System.Web." there is not
HttpContext...

Am I missing something here?

-----Original Message-----
I think you might be misunderstanding the message.
The message is probably referring to the Session object
being nothing, not the content.

Session will never bomb out on an object being nothing in
the context you show. Session will be nothing in any
classes you create. Instead,
use "Current.Session.item..." and you should be able to
get your object just fine.

It helps to put a reference to:
System.Web.HttpContext
in your "Imports" in the project properties under the
properties page, Common Properties folder. Otherwise you
need to reference System.Web.HttpContext.Current.Session

Email if you need more...
-----Original Message-----
Ok...

in Global.asax I have:

protected void Session_Start(Object sender, EventArgs e)
{
cms.errorHandler error = new cms.errorHandler();
Session["error"] = error;
}

and then in my code I have:

errorHandler error = (errorHandler)Session["error"];

I get:
Object Reference not set to an instance of an object
(NullReferenceException).

I even get the Exception if I do:

Session["test"] = "Test";

Yes I debug the application
.

.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nick Whitelegg | last post by:
Hello, I'm having an odd problem with combining an authentication session variable with header() redirection. Basically I have an authentication script which checks a username/password. If the...
11
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option...
1
by: Scott Wickham | last post by:
I'm having a problem saving session information on one form and retrieving it on a subsequent form...for only one out of a number of users. Actually, I'm not absolutely certain it's a session...
1
by: farooqazeem | last post by:
Hi guys, I’m facing some problem can u solve it. Problem is: I’m giving user Id and password in (Login_sess.asp) and submit it to page (sess_test.asp). I am setting session variable...
5
by: Marc Rivait | last post by:
Here is a very interesting scenario. I have a simple test application that loads a page and sets a session variable on the load event. On the first page there is a link to a second page. The...
9
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
1
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can...
7
by: Lucas Tam | last post by:
I'm calling the session object from an inherited page. The page is based off an herited class which outputs XML. Does anyone know why the session object would be nothing? ...
4
by: T Ralya | last post by:
I am told that ASP.NET controls the session ID and session variables, but that does not fit my symptoms. I am posting here as directed. I'm hoping that someone can at least recommend something to...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.