473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT Getting null reference errors on 404??

Hello there,

I'm getting the following error

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

at shopping_bag.Ge tBagTotals()

which then causes this following error which stops the application pool my
web application is running on

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4 app_code,
P5 1.0.2587.41853, P6 45c1694a, P7 a6, P8 0, P9
system.nullrefe renceexception, P10 NIL.
The GetBagTotals does not have a null reference in it from what I can see. I
only get this error when a visitor hits a page that is non existent, for
example www.domain.com/otherpage.aspx. (recently updated the site so a lot
of pages are no longer there). When these pages are hit I get the following:

Explanation: The Web server connection was closed.
Technical Information (for support personnel)

a.. Error Code 64: Host not available
b.. Background: The connection to the Web server was lost.
And the two errors listed above. I have the 404, 404;2,404;3 in IIS set to
go to an aspx page which works great if someone goes to an .html page that
is no longer available. Weird eh?

So if a user tries to visit a page that is no longer available and it ends
in aspx, they don't get a 404 error, they get what is displayed above and
then a null reference error occurs. If a user tries to visit a page that
ends in .html they get the correct 404 error page and no null errors.

Any ideas why aspx pages are not responding to a 404?

Thanks,

David Lozzi
Feb 1 '07 #1
6 3612
I tried adding

<customErrors mode="RemoteOnl y">

<error statusCode="400 " redirect="notfo und.aspx" />

<error statusCode="401 " redirect="notfo und.aspx" />

<error statusCode="403 " redirect="notfo und.aspx" />

<error statusCode="404 " redirect="notfo und.aspx" />

<error statusCode="408 " redirect="notfo und.aspx" />

<error statusCode="500 " redirect="notfo und.aspx" />

<error statusCode="503 " redirect="notfo und.aspx" />

</customErrors>

To the web.config file and that didn't work either. Still get the previously
stated errors.

I'm sorry, the server is a Win2003 Standard SP1.

Thanks!

"David Lozzi" <dl****@nospam. nospamwrote in message
news:uA******** ******@TK2MSFTN GP03.phx.gbl...
Hello there,

I'm getting the following error

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

at shopping_bag.Ge tBagTotals()

which then causes this following error which stops the application pool my
web application is running on

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4
app_code, P5 1.0.2587.41853, P6 45c1694a, P7 a6, P8 0, P9
system.nullrefe renceexception, P10 NIL.
The GetBagTotals does not have a null reference in it from what I can see.
I only get this error when a visitor hits a page that is non existent, for
example www.domain.com/otherpage.aspx. (recently updated the site so a lot
of pages are no longer there). When these pages are hit I get the
following:

Explanation: The Web server connection was closed.
Technical Information (for support personnel)

a.. Error Code 64: Host not available
b.. Background: The connection to the Web server was lost.
And the two errors listed above. I have the 404, 404;2,404;3 in IIS set to
go to an aspx page which works great if someone goes to an .html page that
is no longer available. Weird eh?

So if a user tries to visit a page that is no longer available and it ends
in aspx, they don't get a 404 error, they get what is displayed above and
then a null reference error occurs. If a user tries to visit a page that
ends in .html they get the correct 404 error page and no null errors.

Any ideas why aspx pages are not responding to a 404?

Thanks,

David Lozzi

Feb 1 '07 #2
oops, asp.net 2.0 application
"David Lozzi" <dl****@nospam. nospamwrote in message
news:uc******** ******@TK2MSFTN GP04.phx.gbl...
>I tried adding

<customErrors mode="RemoteOnl y">

<error statusCode="400 " redirect="notfo und.aspx" />

<error statusCode="401 " redirect="notfo und.aspx" />

<error statusCode="403 " redirect="notfo und.aspx" />

<error statusCode="404 " redirect="notfo und.aspx" />

<error statusCode="408 " redirect="notfo und.aspx" />

<error statusCode="500 " redirect="notfo und.aspx" />

<error statusCode="503 " redirect="notfo und.aspx" />

</customErrors>

To the web.config file and that didn't work either. Still get the
previously stated errors.

I'm sorry, the server is a Win2003 Standard SP1.

Thanks!

"David Lozzi" <dl****@nospam. nospamwrote in message
news:uA******** ******@TK2MSFTN GP03.phx.gbl...
>Hello there,

I'm getting the following error

System.NullRef erenceException : Object reference not set to an instance of
an object.

at shopping_bag.Ge tBagTotals()

which then causes this following error which stops the application pool
my web application is running on

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4
app_code, P5 1.0.2587.41853, P6 45c1694a, P7 a6, P8 0, P9
system.nullref erenceexception , P10 NIL.
The GetBagTotals does not have a null reference in it from what I can
see. I only get this error when a visitor hits a page that is non
existent, for example www.domain.com/otherpage.aspx. (recently updated
the site so a lot of pages are no longer there). When these pages are hit
I get the following:

Explanation: The Web server connection was closed.
Technical Information (for support personnel)

a.. Error Code 64: Host not available
b.. Background: The connection to the Web server was lost.
And the two errors listed above. I have the 404, 404;2,404;3 in IIS set
to go to an aspx page which works great if someone goes to an .html page
that is no longer available. Weird eh?

So if a user tries to visit a page that is no longer available and it
ends in aspx, they don't get a 404 error, they get what is displayed
above and then a null reference error occurs. If a user tries to visit a
page that ends in .html they get the correct 404 error page and no null
errors.

Any ideas why aspx pages are not responding to a 404?

Thanks,

David Lozzi


Feb 1 '07 #3
hi David,
it is clear that some of your application code is running when the
non-existent page is requested.
this is probably in application_beg inrequest or session_start in
global.asax?
if not there must be some other httphandler or module running that is
invoking your code.
can you debug the server and set a breakpoint before the nullref exception?
then look at the stacktrace and see where it comes from. it will probably
say <non user codebut you may get a clue.

hope this helps
tim
"David Lozzi" <dl****@nospam. nospamwrote in message
news:eq******** ******@TK2MSFTN GP06.phx.gbl...
oops, asp.net 2.0 application
"David Lozzi" <dl****@nospam. nospamwrote in message
news:uc******** ******@TK2MSFTN GP04.phx.gbl...
>>I tried adding

<customError s mode="RemoteOnl y">

<error statusCode="400 " redirect="notfo und.aspx" />

<error statusCode="401 " redirect="notfo und.aspx" />

<error statusCode="403 " redirect="notfo und.aspx" />

<error statusCode="404 " redirect="notfo und.aspx" />

<error statusCode="408 " redirect="notfo und.aspx" />

<error statusCode="500 " redirect="notfo und.aspx" />

<error statusCode="503 " redirect="notfo und.aspx" />

</customErrors>

To the web.config file and that didn't work either. Still get the
previously stated errors.

I'm sorry, the server is a Win2003 Standard SP1.

Thanks!

"David Lozzi" <dl****@nospam. nospamwrote in message
news:uA******* *******@TK2MSFT NGP03.phx.gbl.. .
>>Hello there,

I'm getting the following error

System.NullRe ferenceExceptio n: Object reference not set to an instance
of an object.

at shopping_bag.Ge tBagTotals()

which then causes this following error which stops the application pool
my web application is running on

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4
app_code, P5 1.0.2587.41853, P6 45c1694a, P7 a6, P8 0, P9
system.nullre ferenceexceptio n, P10 NIL.
The GetBagTotals does not have a null reference in it from what I can
see. I only get this error when a visitor hits a page that is non
existent, for example www.domain.com/otherpage.aspx. (recently updated
the site so a lot of pages are no longer there). When these pages are
hit I get the following:

Explanation: The Web server connection was closed.
Technical Information (for support personnel)

a.. Error Code 64: Host not available
b.. Background: The connection to the Web server was lost.
And the two errors listed above. I have the 404, 404;2,404;3 in IIS set
to go to an aspx page which works great if someone goes to an .html page
that is no longer available. Weird eh?

So if a user tries to visit a page that is no longer available and it
ends in aspx, they don't get a 404 error, they get what is displayed
above and then a null reference error occurs. If a user tries to visit a
page that ends in .html they get the correct 404 error page and no null
errors.

Any ideas why aspx pages are not responding to a 404?

Thanks,

David Lozzi


Feb 1 '07 #4
also david, just to add to my previous reply.
i would bet a tenner that your shopping_bag object is null, and this is the
reason for the exception, rather than the exception occuring inside the
method itself.

tim

Feb 1 '07 #5
Try this :

Errors.aspx:
-----------------
<html>
<script language="VB" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim errMessage As String = ""
Dim appException As System.Exceptio n = Server.GetLastE rror()
If (TypeOf (appException) Is HttpException) Then
Dim checkException As HttpException = CType(appExcept ion, HttpException)
Select Case checkException. GetHttpCode
Case 400
errMessage &= "Bad request. The file size is too large."
Case 401
errMessage &= "You are not authorized to view this page."
Case 403
errMessage &= "You are not allowed to view that page."
Case 404
errMessage &= "The page you have requested can't be found."
Case 408
errMessage &= "The request has timed out."
Case 500
errMessage &= "The server can't fulfill your request."
Case Else
errMessage &= "The server has experienced an error."
End Select
Else
errMessage &= "The following error occurred<BR>" & appException.To String
End If
ErrorMessage.Te xt = errMessage & "<BR>We're sorry for the inconvenience."
Server.ClearErr or()
End Sub
</script>

<body>
<hr>
<asp:label id="ErrorMessag e" font-size="12" font-bold="true" runat=server/>
<hr>
<p>Return to <a href="http://www.server.com/"The site's entry page</a>
</body>
</html>
---------------

Modify the cases to taste.

Some will not be available because they're not customizable,
but 404s will be caught and the user will be redirected to the "errors.asp x" page.

You could also modify the response to perform other tasks.

Then, in your web.config, add either:

<customErrors mode="RemoteOnl y" defaultRedirect ="Errors.asp x"/>

or

<customErrors mode="On" defaultRedirect ="Errors.asp x"/>


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"David Lozzi" <dl****@nospam. nospamwrote in message news:uc******** ******@TK2MSFTN GP04.phx.gbl...
>I tried adding

<customErrors mode="RemoteOnl y">

<error statusCode="400 " redirect="notfo und.aspx" />

<error statusCode="401 " redirect="notfo und.aspx" />

<error statusCode="403 " redirect="notfo und.aspx" />

<error statusCode="404 " redirect="notfo und.aspx" />

<error statusCode="408 " redirect="notfo und.aspx" />

<error statusCode="500 " redirect="notfo und.aspx" />

<error statusCode="503 " redirect="notfo und.aspx" />

</customErrors>

To the web.config file and that didn't work either. Still get the previously stated errors.

I'm sorry, the server is a Win2003 Standard SP1.

Thanks!
Feb 1 '07 #6
Oops some more, sorry for the late info... ISA 2004 Standard is also running
on this server. The more I research this error I see more and more ISA
related issues however nothing pertaining to this yet.
"David Lozzi" <dl****@nospam. nospamwrote in message
news:uA******** ******@TK2MSFTN GP03.phx.gbl...
Hello there,

I'm getting the following error

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

at shopping_bag.Ge tBagTotals()

which then causes this following error which stops the application pool my
web application is running on

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4
app_code, P5 1.0.2587.41853, P6 45c1694a, P7 a6, P8 0, P9
system.nullrefe renceexception, P10 NIL.
The GetBagTotals does not have a null reference in it from what I can see.
I only get this error when a visitor hits a page that is non existent, for
example www.domain.com/otherpage.aspx. (recently updated the site so a lot
of pages are no longer there). When these pages are hit I get the
following:

Explanation: The Web server connection was closed.
Technical Information (for support personnel)

a.. Error Code 64: Host not available
b.. Background: The connection to the Web server was lost.
And the two errors listed above. I have the 404, 404;2,404;3 in IIS set to
go to an aspx page which works great if someone goes to an .html page that
is no longer available. Weird eh?

So if a user tries to visit a page that is no longer available and it ends
in aspx, they don't get a 404 error, they get what is displayed above and
then a null reference error occurs. If a user tries to visit a page that
ends in .html they get the correct 404 error page and no null errors.

Any ideas why aspx pages are not responding to a 404?

Thanks,

David Lozzi

Feb 1 '07 #7

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

Similar topics

2
1625
by: learner | last post by:
Hi, In a page, i have many links. I have some functions in a global file which is included in all linked pages. I want to have a reference to a window which is to be opened on clicking one link and it should be known only to one more link on that page and not to other links. I cant have that window reference in that global file, since iam declaring it initially as Null and modifying its value in that one particular link. Since all links...
8
1821
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for any help... Error: -----
13
10124
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the parent table. ----------------------------
2
1447
by: settyv | last post by:
Hi, I have webform which has 4 Datagrid controls with (built-in Pagination) and 4 search buttons to perform the search operation.When i click on search operation it is displaying the results in grid .when i click next it is telling error...Please let me know how to solve this problem. Below method can be used for all the datagrids.
0
234
by: David Lozzi | last post by:
Hello there, I'm getting the following error System.NullReferenceException: Object reference not set to an instance of an object. at shopping_bag.GetBagTotals()
0
1479
by: banderson777 | last post by:
Hello, I'm a bit new at in-depth IE programming, and am having a bit of trouble with a couple of IE browser extensions (getting them to talk to each other). The first one is a C++ Browser Helper Object (BHO). I have a class (MyClass) that has a method called "ReferenceMe" that calls the browser's "PutProperty" method to save a reference to the BHO instance in IE. Theoretically other COM object should be able to call IE's...
3
9541
by: tshad | last post by:
I have a file that I converted from VB.Net to C# that works fine in VB.Net when I compile but not in C# using the same libraries. The error I am getting is: PageInit.cs(9,7): error CS0138: A using namespace directive can only be applied to namespaces; 'System.Web.HttpCookie' is a class not a namespace The code is:
1
2092
by: javabeginner123 | last post by:
i have a java prob, and i have to solve it fast, but i'm just getting to know it, so plz help me solve it with full code completed, thanks so much. the prob is to create a monter fight and there is the description: The monsters are of a very strange kind, called "Bigmon". They have some basic characteristics, like attack and defense power, life points, a name, and a bonus factor that is used in special occasions. In this initial phase of the...
2
2373
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created table login with fields username(varchar(50)), password(varchar(50)), firstname(varchar(50)), lastname(varchar(50)). U had to display username , first name, last name in default.aspx page after login. One more condition is that, if user fails login...
0
8428
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
8337
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,...
0
8851
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, 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...
0
8748
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...
0
8628
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...
1
6181
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
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1739
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.