473,486 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Object Error

I've read through the prevoius posts and coudln't find an answer. I'm getting a "Object reference not set to an instance of an object." and can't figure out why. My pageload sub is check for login = true, then cookie to login, then bounce to login page. So I find if the user isn't logged in and there is no cookie I get this error. I have no drop-downs within the "If Not IsPostBack Then". I have dataasbe calls (datareader) to populate the server objects once login in met. I'm also showing or hiding panels once login is met.
Why is this error occuring (my webconfig fiel is fine, etc.)

Error in: http://www.nasba.com/manage/Default.aspx
Error Message: Object reference not set to an instance of an object.
Stack Trace:
at manageaccount.Page_Load() at System.Web.Util.ArglessEventHandlerDelegateProxy.C allback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()

thanx!
Nov 18 '05 #1
2 1043
Chris,

You need to check if the cookie exists before casting it to a value. For
example, if you are casting the cookie contents to a string you need to wrap
that cast in an if then checking if the cookie is not nothing first.

Dim UserId As Int32 = 0
If Not Request.Cookies.Item("UserId") Is Nothing Then
UserId = CType(Request.Cookies.Item("UserId"), Int32)
End If

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
I've read through the prevoius posts and coudln't find an answer. I'm getting a "Object reference not set to an instance of an object." and can't
figure out why. My pageload sub is check for login = true, then cookie to
login, then bounce to login page. So I find if the user isn't logged in and
there is no cookie I get this error. I have no drop-downs within the "If Not
IsPostBack Then". I have dataasbe calls (datareader) to populate the server
objects once login in met. I'm also showing or hiding panels once login is
met. Why is this error occuring (my webconfig fiel is fine, etc.)

Error in: http://www.nasba.com/manage/Default.aspx
Error Message: Object reference not set to an instance of an object.
Stack Trace:
at manageaccount.Page_Load() at System.Web.Util.ArglessEventHandlerDelegateProxy.C allback(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain()
thanx!

Nov 18 '05 #2
thanx, I thought I was doing that but made a slight change in the order, which I was already doing in another area, and it worked. thanx for hitting me with a brick and waking me up.

"S. Justin Gengo" wrote:
Chris,

You need to check if the cookie exists before casting it to a value. For
example, if you are casting the cookie contents to a string you need to wrap
that cast in an if then checking if the cookie is not nothing first.

Dim UserId As Int32 = 0
If Not Request.Cookies.Item("UserId") Is Nothing Then
UserId = CType(Request.Cookies.Item("UserId"), Int32)
End If

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
I've read through the prevoius posts and coudln't find an answer. I'm

getting a "Object reference not set to an instance of an object." and can't
figure out why. My pageload sub is check for login = true, then cookie to
login, then bounce to login page. So I find if the user isn't logged in and
there is no cookie I get this error. I have no drop-downs within the "If Not
IsPostBack Then". I have dataasbe calls (datareader) to populate the server
objects once login in met. I'm also showing or hiding panels once login is
met.
Why is this error occuring (my webconfig fiel is fine, etc.)

Error in: http://www.nasba.com/manage/Default.aspx
Error Message: Object reference not set to an instance of an object.
Stack Trace:
at manageaccount.Page_Load() at

System.Web.Util.ArglessEventHandlerDelegateProxy.C allback(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain()

thanx!


Nov 18 '05 #3

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

Similar topics

2
10514
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
2
2404
by: Nithi Gurusamy | last post by:
Dear Group: I have a COM object developed in VB. It makes ADODB calls. When it fails it Raise Error. I am using the COM object in my ASP using Server.CreateObject. Whenever a function call fails...
9
8555
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
8
3983
by: mcmg | last post by:
Hi, I have an asp app that works fine on a windows xp machine but does not work on a windows 2000 server. I have the following code in my global.asa: <OBJECT RUNAT=Server SCOPE=SESSION...
2
2380
by: Roby Eisenbraun Martins | last post by:
Hi, My name is Roby Eisenbraun Martins, I am a C++, VB and NET developer. I am working with a NET 2002 project right now and I am receiving this uncommon "OutOfMemory" error message when I try...
0
2612
by: Dirk Försterling | last post by:
Hi all, a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following the instructions in the INSTALL file, including dump and restore. All this worked fine without any error (message). ...
0
2115
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops...
6
6098
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
1
5522
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two...
2
4922
by: Moses | last post by:
Hi All, Is is possible to catch the error of an undefined element while creating an object for it. Consider we are not having an element with id indicator but we are trying to make the object...
0
6967
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...
0
7132
Oralloy
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,...
0
7180
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...
0
5439
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,...
1
4870
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...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
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 ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.