intermittant error on web server

J

James Wallace

I hope that someone can help me out there with this problem.

I get an itermittant problem with our web page that occurs about once
every 10 to 15 days where the only way to fix the problem is to bounce
the web server. The error can be seen below.

I have looked at the stack trace and determined where the error is
occuring but when I look at my code, where it says that I have an
unhandled exception, I have error handling to handle it. You can see
the code below the error message.

What could be casuing this intermittant behaviour.

Thanks

James

****************************************************************************
**********************ERROR
MESSAGE*****************************************
****************************************************************************
Server Error in '/' Application.
--------------------------------------------------------------------------------

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.NullReferenceException: 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:

[NullReferenceException: Object reference not set to an instance of an
object.]
login.AccountAccess.Page_Load(Object sender, EventArgs e) +7514
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


***************************************************************************
***************CODE********************************************************
***************************************************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim PremNo, CustNo, FirstName, MiddleName, LastName As String
Dim StreetName, StreetNumber, PostDirection, PreDirection,
ZipCode, State, Unit, UnitNumber, Suffix, City As String
Dim AmountDue, DueDate, PayByCheck As String

Try
'control page caching so
'that page is not cached
Response.Buffer = True
Response.Expires = 0
Response.ExpiresAbsolute = Now.AddDays(-1)
Response.CacheControl = "no-cache"

If (Not IsPostBack) Then

'******************************************
'****** Fill data in dataset **************
'******************************************
Try
'Get Balance Information
Me.daBalance.SelectCommand.Parameters("PremNo").Value
= Session("PremNo")
Me.daBalance.SelectCommand.Parameters("CustNo").Value
= Session("CustNo")
Me.daBalance.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Balance Information: "
& ex.InnerException.Message & " " & ex.Message)
End Try

Try
'Get the due date
Me.daDueDate.SelectCommand.Parameters("PremNo").Value
= Session("PremNo")
Me.daDueDate.SelectCommand.Parameters("CustNo").Value
= Session("CustNo")
Me.daDueDate.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Due Date: " &
ex.InnerException.Message & " " & ex.Message)
End Try

Try
'Get Account Name
Me.daName.SelectCommand.Parameters("CustNo").Value
= Session("CustNo")
Me.daName.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Account Information: "
& ex.InnerException.Message & " " & ex.Message)
End Try

Try
'Get account service address
Me.daServiceAddress.SelectCommand.Parameters("PremNo").Value
= Session("PremNo")
Me.daServiceAddress.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Account Service
Address: " & ex.InnerException.Message & " " & ex.Message)
End Try

'set labels with data
lblAcctNo.Text = Session("CustNo") & "-" &
Session("PremNo")
Session("AcctNo") = lblAcctNo.Text

Try
'get data from UCBCUST table and add data to
respective labels
FirstName = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_FIRST_NAME")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_FIRST_NAME"), "")
MiddleName = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_MIDDLE_NAME")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_MIDDLE_NAME"), "")
LastName = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_LAST_NAME")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_LAST_NAME"), "")
PayByCheck = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_PAY_BY_CHECK_IND")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_PAY_BY_CHECK_IND"),
"")
lblName.Text = IIf(Len(FirstName) > 0, FirstName &
" ", "") & _
IIf(Len(MiddleName) > 0, MiddleName
& " ", "") & _
IIf(Len(LastName) > 0, LastName,
"")
lblAllowedToPayByCheck.Text = IIf(Len(PayByCheck)
0, PayByCheck, "N")
Catch ex As Exception
Throw New Exception("Retrieve Account Information:
" & ex.InnerException.Message & " " & ex.Message)
End Try

'add data to session variables
Session("Name") = lblName.Text
Session("FirstName") = FirstName
Session("LastName") = LastName
Session("PayByCheck") = lblAllowedToPayByCheck.Text

Try
'get address info from UCBPREM table
StreetName = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NAME")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NAME"), "")
StreetNumber = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NUMBER")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NUMBER"),
"")
PostDirection = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_POST")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_POST"),
"")
PreDirection = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_PRE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_PRE"),
"")
ZipCode = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_ZIPC_CODE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_ZIPC_CODE"), "")
State = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STAT_CODE_ADDR")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STAT_CODE_ADDR"),
"")
Unit = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UTYP_CODE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UTYP_CODE"), "")
UnitNumber = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UNIT")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UNIT"), "")
Suffix = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_SSFX_CODE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_SSFX_CODE"), "")
City = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_CITY")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_CITY"), "")
lblAddress1.Text = IIf(Len(StreetNumber) > 0,
StreetNumber & " ", "") & _
IIf(Len(PreDirection) > 0,
PreDirection & " ", "") & _
IIf(Len(StreetName) > 0,
StreetName & " ", "") & _
IIf(Len(Suffix) > 0, Suffix & "
", "") & _
IIf(Len(PostDirection) > 0,
PostDirection & " ", "") & _
IIf(Len(Unit) > 0, Unit & " ",
"") & _
IIf(Len(UnitNumber) > 0,
UnitNumber & " ", "")
lblAddress2.Text = IIf(Len(City) > 0, City & ", ",
"") & _
IIf(Len(State) > 0, State & "
", "") & _
IIf(Len(ZipCode) > 0, ZipCode,
"")
Catch ex As Exception
Throw New Exception("Retrieve Address Information:
" & ex.InnerException.Message & " " & ex.Message)
End Try

'add address lines to session variables
Session("Address1") = lblAddress1.Text
Session("Address2") = lblAddress2.Text
Session("City") = City
Session("State") = State
Session("ZipCode") = ZipCode

Try
'get amount due ;)
lblAmountDue.Text = IIf(Not
IsDBNull(dsUserData.Tables("SII_BAL_VIEW").Rows(0).Item("BALANCE")),
dsUserData.Tables("SII_BAL_VIEW").Rows(0).Item("BALANCE"), "0")
Catch ex As Exception
Throw New Exception("Retrieve Amount Due: " &
ex.InnerException.Message & " " & ex.Message)
End Try

'add amount due to session variables
Session("AmountDue") = lblAmountDue.Text

Try
'get amount due date ;)
If (dsUserData.Tables("DUE_DATE_VIEW").Rows.Count
lblDueDate.Text =
dsUserData.Tables("DUE_DATE_VIEW").Rows(0).Item("DUE_DATE")
Else
lblDueDate.Text = ""
End If

Catch ex As Exception
Throw New Exception("Retrieve Due Date: " &
ex.InnerException.Message & " " & ex.Message)
End Try

'add due date to session variables
Session("DueDate") = lblDueDate.Text

End If
Catch ex As Exception
Session("ErrorMessage") = "AccountAccess.Page_Load: " &
ex.InnerException.Message & " " & ex.Message
Response.Redirect("../Error.aspx", False)
End Try
End Sub
 
K

Karl Seguin

Consider refactoring your code to improve readability and substantially
lower your maintenance cost.

With that out of the way, I'll have to defer to the holywoord popularized
ockham's razor. In this case, the simplest explanation I see is the
exception is occuring in your final catch block:

Session("ErrorMessage") = "AccountAccess.Page_Load: " &
ex.InnerException.Message & " " & ex.Message
Response.Redirect("../Error.aspx", False)

it's possible that ex.InnerException is null/nothing is my only
guess.....if your code caused a SystemOutOfMemory exception for example, I
believe you might see that...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


James Wallace said:
I hope that someone can help me out there with this problem.

I get an itermittant problem with our web page that occurs about once
every 10 to 15 days where the only way to fix the problem is to bounce
the web server. The error can be seen below.

I have looked at the stack trace and determined where the error is
occuring but when I look at my code, where it says that I have an
unhandled exception, I have error handling to handle it. You can see
the code below the error message.

What could be casuing this intermittant behaviour.

Thanks

James

****************************************************************************
**********************ERROR
MESSAGE*****************************************
****************************************************************************
Server Error in '/' Application.
-------------------------------------------------------------------------- ------

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.NullReferenceException: 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:

[NullReferenceException: Object reference not set to an instance of an
object.]
login.AccountAccess.Page_Load(Object sender, EventArgs e) +7514
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750


******************************************************************************************CODE***********************************************************************************************************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim PremNo, CustNo, FirstName, MiddleName, LastName As String
Dim StreetName, StreetNumber, PostDirection, PreDirection,
ZipCode, State, Unit, UnitNumber, Suffix, City As String
Dim AmountDue, DueDate, PayByCheck As String

Try
'control page caching so
'that page is not cached
Response.Buffer = True
Response.Expires = 0
Response.ExpiresAbsolute = Now.AddDays(-1)
Response.CacheControl = "no-cache"

If (Not IsPostBack) Then

'******************************************
'****** Fill data in dataset **************
'******************************************
Try
'Get Balance Information
Me.daBalance.SelectCommand.Parameters("PremNo").Value
= Session("PremNo")
Me.daBalance.SelectCommand.Parameters("CustNo").Value
= Session("CustNo")
Me.daBalance.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Balance Information: "
& ex.InnerException.Message & " " & ex.Message)
End Try

Try
'Get the due date
Me.daDueDate.SelectCommand.Parameters("PremNo").Value
= Session("PremNo")
Me.daDueDate.SelectCommand.Parameters("CustNo").Value
= Session("CustNo")
Me.daDueDate.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Due Date: " &
ex.InnerException.Message & " " & ex.Message)
End Try

Try
'Get Account Name
Me.daName.SelectCommand.Parameters("CustNo").Value
= Session("CustNo")
Me.daName.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Account Information: "
& ex.InnerException.Message & " " & ex.Message)
End Try

Try
'Get account service address
Me.daServiceAddress.SelectCommand.Parameters("PremNo").Value
= Session("PremNo")
Me.daServiceAddress.Fill(dsUserData)
Catch ex As Exception
Throw New Exception("Query Account Service
Address: " & ex.InnerException.Message & " " & ex.Message)
End Try

'set labels with data
lblAcctNo.Text = Session("CustNo") & "-" &
Session("PremNo")
Session("AcctNo") = lblAcctNo.Text

Try
'get data from UCBCUST table and add data to
respective labels
FirstName = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_FIRST_NAME")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_FIRST_NAME"), "")
MiddleName = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_MIDDLE_NAME")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_MIDDLE_NAME"), "")
LastName = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_LAST_NAME")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_LAST_NAME"), "")
PayByCheck = IIf(Not
IsDBNull(dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_PAY_BY_CHECK_IND
")),
dsUserData.Tables("UCBCUST").Rows(0).Item("UCBCUST_PAY_BY_CHECK_IND"),
"")
lblName.Text = IIf(Len(FirstName) > 0, FirstName &
" ", "") & _
IIf(Len(MiddleName) > 0, MiddleName
& " ", "") & _
IIf(Len(LastName) > 0, LastName,
"")
lblAllowedToPayByCheck.Text = IIf(Len(PayByCheck)
0, PayByCheck, "N")
Catch ex As Exception
Throw New Exception("Retrieve Account Information:
" & ex.InnerException.Message & " " & ex.Message)
End Try

'add data to session variables
Session("Name") = lblName.Text
Session("FirstName") = FirstName
Session("LastName") = LastName
Session("PayByCheck") = lblAllowedToPayByCheck.Text

Try
'get address info from UCBPREM table
StreetName = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NAME")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NAME"), "")
StreetNumber = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NUMBER"))
,
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STREET_NUMBER"),
"")
PostDirection = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_POST")
),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_POST"),
"")
PreDirection = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_PRE"))
,
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_PDIR_CODE_PRE"),
"")
ZipCode = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_ZIPC_CODE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_ZIPC_CODE"), "")
State = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STAT_CODE_ADDR")
),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_STAT_CODE_ADDR"),
"")
Unit = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UTYP_CODE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UTYP_CODE"), "")
UnitNumber = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UNIT")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_UNIT"), "")
Suffix = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_SSFX_CODE")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_SSFX_CODE"), "")
City = IIf(Not
IsDBNull(dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_CITY")),
dsUserData.Tables("UCBPREM").Rows(0).Item("UCBPREM_CITY"), "")
lblAddress1.Text = IIf(Len(StreetNumber) > 0,
StreetNumber & " ", "") & _
IIf(Len(PreDirection) > 0,
PreDirection & " ", "") & _
IIf(Len(StreetName) > 0,
StreetName & " ", "") & _
IIf(Len(Suffix) > 0, Suffix & "
", "") & _
IIf(Len(PostDirection) > 0,
PostDirection & " ", "") & _
IIf(Len(Unit) > 0, Unit & " ",
"") & _
IIf(Len(UnitNumber) > 0,
UnitNumber & " ", "")
lblAddress2.Text = IIf(Len(City) > 0, City & ", ",
"") & _
IIf(Len(State) > 0, State & "
", "") & _
IIf(Len(ZipCode) > 0, ZipCode,
"")
Catch ex As Exception
Throw New Exception("Retrieve Address Information:
" & ex.InnerException.Message & " " & ex.Message)
End Try

'add address lines to session variables
Session("Address1") = lblAddress1.Text
Session("Address2") = lblAddress2.Text
Session("City") = City
Session("State") = State
Session("ZipCode") = ZipCode

Try
'get amount due ;)
lblAmountDue.Text = IIf(Not
IsDBNull(dsUserData.Tables("SII_BAL_VIEW").Rows(0).Item("BALANCE")),
dsUserData.Tables("SII_BAL_VIEW").Rows(0).Item("BALANCE"), "0")
Catch ex As Exception
Throw New Exception("Retrieve Amount Due: " &
ex.InnerException.Message & " " & ex.Message)
End Try

'add amount due to session variables
Session("AmountDue") = lblAmountDue.Text

Try
'get amount due date ;)
If (dsUserData.Tables("DUE_DATE_VIEW").Rows.Count
lblDueDate.Text =
dsUserData.Tables("DUE_DATE_VIEW").Rows(0).Item("DUE_DATE")
Else
lblDueDate.Text = ""
End If

Catch ex As Exception
Throw New Exception("Retrieve Due Date: " &
ex.InnerException.Message & " " & ex.Message)
End Try

'add due date to session variables
Session("DueDate") = lblDueDate.Text

End If
Catch ex As Exception
Session("ErrorMessage") = "AccountAccess.Page_Load: " &
ex.InnerException.Message & " " & ex.Message
Response.Redirect("../Error.aspx", False)
End Try
End Sub
 
D

David Cheever

I hope that someone can help me out there with this problem.

I get an itermittant problem with our web page that occurs about once
every 10 to 15 days where the only way to fix the problem is to bounce
the web server. The error can be seen below.

I have looked at the stack trace and determined where the error is
occuring but when I look at my code, where it says that I have an
unhandled exception, I have error handling to handle it. You can see
the code below the error message.

What could be casuing this intermittant behaviour.

Thanks

James


Did you find a solution on this? I have a new, similar issue with a
server running XP. I'm wondering if it has to do with Installing XP
Service Pack 2.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top