InternalServerError - Object reference not set...

kconklinkconklin Posts: 14
edited January 31, 2006 1:42PM in ANTS Load
I'm getting 'InternalServerError' when posting a specific page in a recorded script, triggered by 'Object reference not set to an instance of an object' errors. No errors occurred when recording the script, or during normal browsing.

This seems similar in nature to a viewstate problem I've seen a few people write to this forum about, but none of the suggested solutions have helped. I've included the error below; along with the portion of the script that causes the error. Brian, could you please take a look at this to see if you recognize what might be going on here? Thanks in advance!!

Error:

Item http://xos-3/XSP/findPrinterResults.asp ... 8d43f0ddbc ASP.NET HTML content <html> <head> <title>Object reference not set to an instance of an object.</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/XSP' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Object reference not set to an instance of an object.</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>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. <br><br> <b> Exception Details: </b>System.NullReferenceException: Object reference not set to an instance of an object.<br><br> <b>Source Error:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code> 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.</code> </td> </tr> </table> <br> <b>Stack Trace:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> [NullReferenceException: Object reference not set to an instance of an object.] Xerox.CustomerUI.PagedDataGrid.ScanForChecksOrRadio() +165 Xerox.CustomerUI.PagedDataGrid.OnInit(EventArgs e) +84 System.Web.UI.Control.InitRecursive(Control namingContainer) +241 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Control.InitRecursive(Control namingContainer) +179 System.Web.UI.Page.ProcessRequestMain() +197 </pre></code> </td> </tr> </table> <br> <hr width=100% size=1 color=silver> <b>Version Information:</b> Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300 </font> </body> </html> <!-- [NullReferenceException]: Object reference not set to an instance of an object. at Xerox.CustomerUI.PagedDataGrid.ScanForChecksOrRadio() at Xerox.CustomerUI.PagedDataGrid.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain() [HttpUnhandledException]: Exception of type System.Web.HttpUnhandledException was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --><!-- This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->

Script: The error causing line is highlighted in red

BeginPage("http://xos-3/XSP/Finds.aspx")
WebClient.HttpRequest.Pragma = "no-cache"
WebClient.HttpRequest.ContentType = "application/x-www-form-urlencoded"
WebClient.HttpRequest.AddPostData("__EVENTTARGET", "", False)
WebClient.HttpRequest.AddPostData("__EVENTARGUMENT", "", False)
WebClient.HttpRequest.AddPostData("__VIEWSTATE", WebClient.ViewState, False)
WebClient.HttpRequest.AddPostData("topNav1%3AneedTo%3AneedToDropDown", "", False)
WebClient.HttpRequest.AddPostData("FindTool", "radioFindPrinter", False)
WebClient.HttpRequest.AddPostData("siteID", "", False)
WebClient.HttpRequest.AddPostData("searchQuery", "", False)
WebClient.HttpRequest.AddPostData("FindPrinter%3Abasicfields", "", False)
WebClient.HttpRequest.AddPostData("FindPrinter%3Aadvfields", "", False)
WebClient.HttpRequest.AddPostData("FindPrinter%3Afilterenabled", "", False)
WebClient.HttpRequest.AddPostData("search_query", "", False)
WebClient.HttpRequest.AddPostData("FindPrinter%3ABasicFindTxt1", "Xerox+DocuPrint+N4025+Network+Laser+Printer", False)
WebClient.HttpRequest.AddPostData("FindPrinter%3AfindNow_button", "Find+Now", False)
WebClient.POST("http://xos-3/XSP/Finds.aspx")
WebClient.HttpRequest.ContentType = Nothing
WebClient.GET("http://xos-3/XSP/findPrinterResults.aspx?CompanyGUID=a9ad3fe0-92a7-4853-8e30-d78d43f0ddbc")
WebClient.HttpRequest.Pragma = Nothing
WebClient.GET("http://xos-3/XSP/DefaultStyle.css")
WebClient.GET("http://xos-3/XSP/RoboHelp_CSH.js")
WebClient.GET("http://xos-3/XSP/images/spacer.gif")
WebClient.GET("http://xos-3/XSP/images/spacer_1.gif")
WebClient.GET("http://xos-3/XSP/images/arrow_control_right.gif")
WebClient.GET("http://xos-3/XSP/images/pixel_b.gif")
WebClient.GET("http://xos-3/XSP/images/arrow_control_left.gif")
WebClient.GET("http://xos-3/XSP/images/iconPrinter.gif")
WebClient.GET("http://xos-3/XSP/images/cmdbtnbg.gif")
EndPage("http://xos-3/XSP/Finds.aspx")
' End of page 3 contains 11 request(s).

Sleep(4734)
BeginPage("http://xos-3/XSP/findPrinterResults.aspx?CompanyGUID=a9ad3fe0-92a7-4853-8e30-d78d43f0ddbc")
WebClient.HttpRequest.Pragma = "no-cache"
WebClient.HttpRequest.ContentType = "application/x-www-form-urlencoded"
WebClient.HttpRequest.AddPostData("pDGridsortfield", "", False)
WebClient.HttpRequest.AddPostData("EnterPressedOn", "+", False)
WebClient.HttpRequest.AddPostData("__EVENTTARGET", "", False)
WebClient.HttpRequest.AddPostData("__EVENTARGUMENT", "", False)
WebClient.HttpRequest.AddPostData("__VIEWSTATE", WebClient.ViewState, False)
WebClient.HttpRequest.AddPostData("topNav1%3AneedTo%3AneedToDropDown", "", False)
WebClient.HttpRequest.AddPostData("pDGrid%3AucPageChooser_top%3AlstCurrentPage", "1", False)
WebClient.HttpRequest.AddPostData("pDGrid%3AucPageChooser_top%3AitemsPerPage", "10", False)
WebClient.HttpRequest.AddPostData("pDGrid%3AtxtFind", "", False)
WebClient.HttpRequest.AddPostData("pDGrid%3AddlFields", "All+Visible", False)
WebClient.HttpRequest.AddPostData("pDGridfilterMODEL_NV", "4D572DC0-29D4-4F34-9173-C7C2DD905052", False)
WebClient.HttpRequest.AddPostData("pDGrid%3AucPageChooser%3AlstCurrentPage", "1", False)
WebClient.HttpRequest.AddPostData("pDGrid%3AucPageChooser%3AitemsPerPage", "10", False)
WebClient.HttpRequest.AddPostData("btnBack", "Back", False)
WebClient.POST("http://xos-3/XSP/findPrinterResults.aspx?CompanyGUID=a9ad3fe0-92a7-4853-8e30-d78d43f0ddbc")
WebClient.HttpRequest.ContentType = Nothing
WebClient.GET("http://xos-3/XSP/Finds.aspx")
WebClient.HttpRequest.Pragma = Nothing
WebClient.GET("http://xos-3/XSP/DefaultStyle.css")
WebClient.GET("http://xos-3/XSP/RoboHelp_CSH.js")
WebClient.GET("http://xos-3/XSP/images/spacer.gif")
WebClient.GET("http://xos-3/XSP/images/spacer_1.gif")
WebClient.GET("http://xos-3/XSP/images/bigIcon_findPrinter.gif")
WebClient.GET("http://xos-3/XSP/images/cmdbtnbg.gif")
EndPage("http://xos-3/XSP/findPrinterResults.aspx?CompanyGUID=a9ad3fe0-92a7-4853-8e30-d78d43f0ddbc")
' End of page 4 contains 8 request(s).
Kevin Conklin
Software Design Engineer in Test
Xerox Global Services

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Kevin,

    The reason you're not going to find information about this is because the error message is so vague. Object Reference errors simply indicate that something required for the operation of this method is set to NULL or doesn't exist.

    If you have access to the code, you could try debugging it to see where the exception occurs and to find the NULL value. If you can't get into the website's code this way, it's going to be really difficult to find the problem.

    Examining the aspx page code may reveal a clue, for instance is there a variable in this particular form that doesn't appear in the AddPostData commands? For each item name (input, option, select, etc tags) there should be a corresponding AddPostData command that sends this data to the website in the ANTS Load script.

    Maybe it would be useful to dig out the aspx page code for this particular page?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    I'd also just noticed this in the script: the first POST request doesn't have a preceding GET for the ASPX page, meaning you're posting back empty WebClient.ViewState back to the server. I think that would also cause a null-reference exception. You should probably do this for the first request:
    BeginPage&#40;"http://xos-3/XSP/Finds.aspx"&#41; 
    WebClient.GET&#40;"http://xos-3/XSP/Finds.aspx"&#41; 
    WebClient.HttpRequest.Pragma = "no-cache" 
    WebClient.HttpRequest.ContentType = "application/x-www-form-urlencoded" 
    WebClient.HttpRequest.AddPostData&#40;"__EVENTTARGET", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"__EVENTARGUMENT", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"__VIEWSTATE", WebClient.ViewState, False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"topNav1%3AneedTo%3AneedToDropDown", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"FindTool", "radioFindPrinter", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"siteID", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"searchQuery", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"FindPrinter%3Abasicfields", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"FindPrinter%3Aadvfields", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"FindPrinter%3Afilterenabled", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"search_query", "", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"FindPrinter%3ABasicFindTxt1", "Xerox+DocuPrint+N4025+Network+Laser+Printer", False&#41; 
    WebClient.HttpRequest.AddPostData&#40;"FindPrinter%3AfindNow_button", "Find+Now", False&#41; 
    WebClient.POST&#40;"http://xos-3/XSP/Finds.aspx"&#41;
    
Sign In or Register to comment.