473,662 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session problem

hi,
I am anand.I used session state object in some pages in my application ex
Session("UserId ").

some times applications displayed the following error

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
pos.TopBanner.P age_Load(Object sender, EventArgs e)
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.P age.ProcessRequ estMain() +772
how to rectify the error?
regards
anand
Sep 22 '06 #1
2 3329
hi,
I am anand.I used session state object in some pages in my application ex
Session("UserId ").

some times applications displayed the following error

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceEx ception: Object reference not set to an instance of an
object.]
pos.TopBanner.P age_Load(Object sender, EventArgs e)
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.P age.ProcessRequ estMain() +772

how to rectify the error?
regards
anand
You didn't specify the source where the error occurred, so it is not
clear to me that it has anything to do with that Session object. But
that /is/ possible.

The error means that you try to use some reference as if it is pointing
to a real instance of a class, but (at this time) it isn't pointing
anywhere (it's null).

Your crash *can* occur in a place where you try to use that session
object, if that object doesn't exist (yet). Say you are trying to use
that object before the person has logged in (causing that userid to be
set).

Solutions:
1) carefully review your application: are you trying to use that
session object before it is filled?
2) check that it really exists before using it. In C#:
if (Session["userid"] != null) ...

Hans Kesting
Sep 22 '06 #2
Hi, check if the session is not null before working with it.
if session("userid ") isnot nothing then
.....
end if

Have you checked your session timeout value?.
---------------------------
Thanks,
Ibrahim

Software Consultant - Web Development, GB
"Hans Kesting" wrote:
hi,
I am anand.I used session state object in some pages in my application ex
Session("UserId ").

some times applications displayed the following error

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceEx ception: Object reference not set to an instance of an
object.]
pos.TopBanner.P age_Load(Object sender, EventArgs e)
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.C ontrol.LoadRecu rsive() +98
System.Web.UI.P age.ProcessRequ estMain() +772

how to rectify the error?
regards
anand

You didn't specify the source where the error occurred, so it is not
clear to me that it has anything to do with that Session object. But
that /is/ possible.

The error means that you try to use some reference as if it is pointing
to a real instance of a class, but (at this time) it isn't pointing
anywhere (it's null).

Your crash *can* occur in a place where you try to use that session
object, if that object doesn't exist (yet). Say you are trying to use
that object before the person has logged in (causing that userid to be
set).

Solutions:
1) carefully review your application: are you trying to use that
session object before it is filled?
2) check that it really exists before using it. In C#:
if (Session["userid"] != null) ...

Hans Kesting
Sep 22 '06 #3

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

Similar topics

1
3997
by: Jonathan Chong | last post by:
I have problem with AOL browser (IE and Netscape are OK) accessing my Web site after putting up a load balancer that will go to W1 or W2. The problem does not happen when there is only Web server and no load balancer installed. The problem is on the checking of the session timeout function. This function will check if the session variable's value is missing. If it is missing, it will direct to time out page.
5
1610
by: Roman | last post by:
Hi, I've installed .net on my server and since then I'm loosing my sessions from my (old) asp. e.g.: Session("test") works on the same page, but if the page is changed the whole session is registered new and sothe stored data is lost. (my session timeout is default on 20 min / bevore my .net installation
0
1206
by: Marek | last post by:
Hi, I have the following session problem: I've created simple login/logout form to prevent unknown users from accessing my private web site part and It is not working on the www server. It seems that the session lasts very shortly - sometimes couple of minutes and sometimes it is even impossible to login. The whole application is working correctly on my local machine but it is not working on the www server. I tried at least 2 hosters. Can...
0
281
by: Sabari | last post by:
Hi, In our application we face a session problem.Its kinda strange as well.We have our session timeout in web.config file to 240 minutes.It works fine in our intranet.When we moved the project to the clients intranet the session gets timed out in 20 mins.We checked with the web.config and all the settings are correct.Is there any other factor that could spoil the sport.Any clues wud help me Thanks and Regards R.Sabari
1
1147
by: caldera | last post by:
Hello, We have a session problem. A dataset is put into a session and call this session value later. When we run this web page in http://localhost it works. But server has a specific name like http://aaa_bbb_ccc . When we try to run this code by writting this name the session parameters doesn't stored and give an error. When we writting ip address of this server it also works, like http://10.1.1.1 How can we solve this problem? Thank you...
4
1424
by: alan | last post by:
Hi, i have some problem in asp.net session problem in page_load -> i have Label1.text = Session("a") in DataGrid1_sortCommand -> i have Session("a") = e.sortExpression
3
1593
by: sri | last post by:
Hi, I have Login page (login.aspx") and after entering into inbox by giving valid userid and password the session item is userid and password. In inbox page ("inbox.aspx") i have logoff button and the code in the button is sessions are null and it redirects to login page. Before clicking the logof button i copy the inbox url. when i get the login page i copy the url in the address box of the browser and when i press enter i am getting the inbox...
2
2050
by: Tom | last post by:
I hope someone can help me figure out what's going on here. I've re-read the section on sessions at php.net and Googled this high and low but I haven't found anything that quite explains my problem. The basic problem: session data (e.g. $_SESSION) gets dropped after visitor logs in and reloads the page via a form once or twice (it seems to vary), requiring the visitor to re-login, whereupon the problem repeats itself. An outline of...
3
1514
by: deepsfriend4u | last post by:
Hello, i have one application in that i use session . problem is, same code and session data use work successful in Firefox but not work in Internet Explore. Thanks & Regards Deepak
2
2104
by: Kong Chun Ho | last post by:
Hi all, I have a php session problem when i echo a session_id, it return nothing! <?php if(!session_start()) { exit(); }else{ ob_start(); session_start(); echo session_id(); echo SID; ob_end_clean(); }?> // html code... nothing returned!
0
8432
marktang
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...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
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,...
0
8633
tracyyun
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...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
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();...
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
bsmnconsultancy
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...

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.