Re: Object reference not set to an instance of an object.

From: Ken Cox [Microsoft MVP] (BANSPAMken_cox_at_sympatico.ca)
Date: 02/18/05


Date: Fri, 18 Feb 2005 07:44:03 -0500

You're using a lot of data in a Session. Is it possible that something is
killing the Session? An anti-virus program on the server would disrupt it.

"kgeorgop" <kgeorgop.1kn8lr@mail.codecomments.com> wrote in message
news:kgeorgop.1kn8lr@mail.codecomments.com...
>
> Can somebody assist. I build this code on a dev laptop and copied across
> the entire code to a Windows 2003 server with 1.1 framework. It is basic
> ASP.NET that uses web service for SQL Server 2000 DB access.
>
> The code works fine on my dev laptop, just not on the non dev machine.
>
> Here is the full error page:
>
> Server Error in '/jobRequest' 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.]
> jobRequest.requestProof.Button1_Click(Object sender, EventArgs e)
> +125
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
> +33
> System.Web.UI.Page.ProcessRequestMain() +1277
>
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:1.1.4322.573;
> ASP.NET Version:1.1.4322.573
>
>
> AND here is the requestProof snippet:
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> 'insert code here for database insertion
> Dim myJobRequest As New skillsDB.jobRequest
>
> ' a web method is called to check whether the name exists or
> not
> Dim checkName As New skillsDB.jobRequest
> Dim userNameSet As DataSet =
> checkName.findUser(Session("Name"))
>
>
> ' if exists then perform and update
> If (userNameSet.Tables(0).Rows.Count <> 0) Then
> Dim updateSkillsIndex As DataSet =
> myJobRequest.userUpdate(Session("Name"), Session("BadgeID"),
> Session("Division"), Session("Location"), Session("Data"),
> Session("Voice"), Session("Converged"), Session("Security"),
> Session("Hosting"), Session("ContactCentres"),
> Session("Infrastructure"), _
>
> Session("Applications"), Session("EMC"), Session("D2WProcess"),
> Session("CostingSpreadsheets"), Session("SalesProcess"),
> Session("TAS"), Session("ManageRelationships"),
> Session("CustomerFocus"), _
>
> Session("CommunicationSkills"), Session("DefineBuyingCriteria"),
> Session("DecisionMaking"), Session("IssueResolution"),
> Session("BidManagement"), Session("VendorManagement"), _
>
> Session("Proposals"), Session("Negotiation"), Session("Presentation"),
> Session("ContractWriting"), Session("BusinessCaseWriting"),
> Session("FinancialDecisions"), Session("TransitionManagement"), _
>
> Session("OperationalManagement"), Session("ProjectManagement"),
> Session("TimeManagement"), Session("QualityFocus"), Session("MSWord"),
> Session("MSProject"), Session("SMART"), Session("MSPowerpoint"), _
>
> Session("MSExcel"), Session("NMS"), Session("OperatingSystems"),
> Session("ApplicationIntegration"), Session("ApplicationDevelopment"),
> Session("PortalDevelopment"), Session("DesktopManagement"), _
>
> Session("EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
> Session("Routers"), Session("Switches"),
> Session("ConvergedTechnologies"), Session("VoiceCarriage"),
> Session("PABX"), Session("KeySystems"), Session("IVR"), _
>
> Session("Firewalls"), Session("IDS"), Session("HIDS"),
> Session("ITSecurityVPN"), Session("Consultancy"))
> Session("Result") = "The skills database has been updated
> with the below details."
> 'if setSkiilsIndex is not NULL, then take me to my receipt
> page
> If Not IsDBNull(updateSkillsIndex) Then
> Response.Redirect("requestComplete.aspx")
> Else
> 'lblMessage.Text = "Database Save Error, please contact
> Mark Ussher!!!"
> End If
> Else
> Dim setSkillsIndex As DataSet =
> myJobRequest.setSkills(Session("Name"), Session("BadgeID"),
> Session("Division"), Session("Location"), Session("Data"),
> Session("Voice"), Session("Converged"), Session("Security"),
> Session("Hosting"), Session("ContactCentres"),
> Session("Infrastructure"), _
>
> Session("Applications"), Session("EMC"), Session("D2WProcess"),
> Session("CostingSpreadsheets"), Session("SalesProcess"),
> Session("TAS"), Session("ManageRelationships"),
> Session("CustomerFocus"), _
>
> Session("CommunicationSkills"), Session("DefineBuyingCriteria"),
> Session("DecisionMaking"), Session("IssueResolution"),
> Session("BidManagement"), Session("VendorManagement"), _
>
> Session("Proposals"), Session("Negotiation"), Session("Presentation"),
> Session("ContractWriting"), Session("BusinessCaseWriting"),
> Session("FinancialDecisions"), Session("TransitionManagement"), _
>
> Session("OperationalManagement"), Session("ProjectManagement"),
> Session("TimeManagement"), Session("QualityFocus"), Session("MSWord"),
> Session("MSProject"), Session("SMART"), Session("MSPowerpoint"), _
>
> Session("MSExcel"), Session("NMS"), Session("OperatingSystems"),
> Session("ApplicationIntegration"), Session("ApplicationDevelopment"),
> Session("PortalDevelopment"), Session("DesktopManagement"), _
>
> Session("EnterpriseDNA"), Session("DataCarriage"), Session("DataVPN"),
> Session("Routers"), Session("Switches"),
> Session("ConvergedTechnologies"), Session("VoiceCarriage"),
> Session("PABX"), Session("KeySystems"), Session("IVR"), _
>
> Session("Firewalls"), Session("IDS"), Session("HIDS"),
> Session("ITSecurityVPN"), Session("Consultancy"))
> Session("Result") = "Your skills have been created in the
> skills database."
> 'if setSkiilsIndex is not NULL, then take me to my receipt
> page
> If Not IsDBNull(setSkillsIndex) Then
> Response.Redirect("requestComplete.aspx")
> Else
> 'lblMessage.Text = "Database Save Error, please contact
> Mark Ussher!!!"
> End If
> End If
> End Sub
>
>
>
> --
> kgeorgop
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>