.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Exception Details: System.NullReferenceException: Object reference not set to an instance of an obje

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net
 

Hi, i have a Problem, i made a ASP.NET Page with VS2010 and now i want to run it on a iis6 (windows server 2003) and i get the message:

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.]

   Bestellung.Bestellung.ImageButton1_Click(Object sender, ImageClickEventArgs e) in D:\foo.aspx.cs:71

   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115

   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120

   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

   System.Web.UI.Page.RaisePostBa


View Complete Post


More Related Resource Links

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

  
        BVWS.Vardering oWS = new BVWS.Vardering();        BVWS.strucBPVardering oSvar1 = new BVWS.strucBPVardering();        BVWS.StrucPaket oPaket = new BVWS.StrucPaket();                 if (Page.IsPostBack)        {             oSvar1 = oWS.BpVardering("", "", regnummer.Text, "2000", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", DropDownList1.SelectedValue);      tdCHK1.Visible = false;                  try            {                if (oSvar1.rubst01.Length > 0)                {                   

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

  
I am working on a Windows 7 professional machine, 64bit,  to learn SQL server 2008.   i'm working with the microsoft sql server 2008 step by step book and i'm stck on configuring email notificaions. i've already goe through the GUI to configure my email settings. however, sql server agent is disabled. when i try to start the service i get the following error: Unhandled exception has occurred in your application....... Object reference not set to an instance of an object. Here are the details of the error message: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. Server stack trace:    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.FindObjectExplorerFrame()    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.GetObjectExplorer(Boolean activateWindow)    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ShowError(Exception e)    at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Service.Start()    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, In

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

  

I have developed an application with asp.net 2.0 and SQL Server 2005. It is working fine on my local PC without any error and exceptions.

When i moved the application to server, i m getting the following runtime exception.

User needs to login initially to enter application. Once they submit login the following exception occur.

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

Here is my error code:

                          Dim dbdata As dataconnection = New dataconnection
Line 54:             Dim dr As SqlDataReader = dbdata.finduser(user_id, user_password)
Line 55:             If dr.HasRows Then   ' error here
Line 56:                 Return True
Line 57:             Else


 Please help me ASAP .  No such exception, when i run on local PC.


Null Reference Exception was not handled by user Object Reference not set to instance of an object

  
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Security.Principal;using System.Data;using System.Data.SqlClient;using System.Windows;using System.Collections; public partial class Default2 : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {     }    private bool tableCopied = false;    private DataTable originalDataTable;     protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)    {         if (e.Row.RowType == DataControlRowType.DataRow)        {            //string sValue = e.Row.Cells[3].Text;             if (!tableCopied)            {                originalDataTable = ((System.Data.DataRowView)e.Row.DataItem).Row.Table.Copy();                ViewState["originalDataTable"] = originalDataTable;      &nbs

NullReferenceException in array? Object reference not set to an instance of an object.

  

I am receiving a NullReferenceException, but I can not find where it is.

The code:


string[] strAccount = null;
 
DateTime[] dtFirstPurchDate = null;
 
DateTime[] dtLastPurchDate = null;
 
TimeSpan[] dtFirstLastPurchDiff = null;

 

//Start iterating through the original gridview with line item totals
 
for (int i = 0; i <= GridViewECI.Rows.Count-1; i++)

            {

if (i == 0)
                {
 
//set first gridview records so we can use it to review next lines of data


                   strAccount[counter] = GridViewECI.Rows[i].Cells[0].Text;
 
                    dtFirstPurchDate[counter] = DateTime.Parse(GridViewECI.Rows[i].Cells[1].Text);


<-- error occurs here at dtFirstPurchDate with Object reference not set to an instance of object


VS2010 Silverlight 4 - Getting "Object reference not set to an instance of an object" when loading a

  
In Visual Studio 2010 I'm trying to use the Blacklight Controls (http://blacklight.codeplex.com/releases/view/37652) in my own project (and actually included the Blacklight.Controls project in my solution so that I could debug what was going on) and... after making all the XAML changes needed to incorporate the Blacklight navigation menu with my stuff in the innermost grid... everything compiled ok when doing a Build.  When I run it there's a reference to a resource dictionary in the XAML that fails with the object reference error above.  The XAML is as follows:       <UserControl.Resources>       <controls:ResourceDictionaryManager x:Key="ResourceDictionaryManager">       <controls:ResourceDictionaryManager.ResourceDictionaries>       <controls:ResourceDictionaryCollection>       <controls:ResourceDictionary Path="/Blacklight.Showcase;component/ResourceDictionaries/DavesGlossyControls.xaml">       <controls:ResourceDictionary.ResourceKeys>       <controls:ResourceKeyCollection>       <controls:ResourceKey ResourceName="GlossyBlackScrollViewer" />       </controls:ResourceKeyCollection>     &

reference not set to an instance of an object.

  
Hi friends,I got this error. This application for  delete  multiple record in gridview using Check Box.Please verify it. I tried before one application, that one finally worked,That application also error occurred, but after some time it execute(automatic I didnt do anything) correctly,Please tell me why this type of error occurred.  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: Line 153: if (chkdelete != null) Line 154: { Line 155: chkall.Checked = array.Contains(grideviewsasmple.DataKeys[i].Value); Line 156: Line 157: if (!chkdelete.Checked) Source File: c:\Inetpub\wwwroot\AdditionUpdate\Default.aspx.cs    Line: 155

Object Reference not set to an instance of an object

  
Hi All,While using listview to upload images I get the error message. "Object Reference not set to an instance of an object".Gallery.aspx is suppose to call ManagePhotoAlbum.aspxError generatedLine 5: Protected Sub LinqDataSource1_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceStatusEventArgs) Handles LinqDataSource1.Inserted Line 6: Dim myPhotoAlbum As PhotoAlbum = CType(e.Result, PhotoAlbum) Line 7: Response.Redirect(String.Format("ManagePhotoAlbum.aspx?PhotoAlbumId={0}", _ Line 8: myPhotoAlbum.Id.ToString())) Line 9: End SubCode Behind Gallery.aspx.vbPartial Class Photo_Gallery    Inherits System.Web.UI.Page    Protected Sub LinqDataSource1_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceStatusEventArgs) Handles LinqDataSource1.Inserted        Dim myPhotoAlbum As PhotoAlbum = CType(e.Result, PhotoAlbum)        Response.Redirect(String.Format("ManagePhotoAlbum.aspx?PhotoAlbumId={0}", _            myPhotoAlbum.Id.ToString()))    End Sub    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    End S

Object reference not set to an instance of an object.

  
This one has been killing me for 2 days now, and it should be so simple.I have a button on a page with an onClick that calls a web service.  I get the above error (on Line 938, Sys.WebForms.PageRequestManagerServerErrorException) as soon as the button is clicked.  The error seems to occur the second that the service is called - I have verified that every step of  the client-side code works and does not contain null values.  When remote debugging, the exception hits as soon as it jumps over to the web service's source code, an indication that the reference to the server itself is also valid.The code: (bad spelling and formatting not mine... I inherited this and have been cleaning it up as I go)'btnClick event - removed the log-writing lines for clarity's sake Private Sub btnSendCIS_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendCIS.Click Dim dt As DataTable Dim retr As String = "" dt = createOrderTable() Dim client As New ProdEndpoints.CISPRODUCTIONClient() retr = client.CompleteOrders(dt) client.Close() tmRecive.Interval = tickinterval getallrecive() End Sub 'createOrderTable - creates the dt that is sent to the service, also with log-writing lines removed. verified this is not returned Null as the log-writing includes pulling ou

Object reference not set to an instance of an object.

  
can anybody help me with this error??the error occurs in the first line of the if statement...i really dont know how to fix this problem.. please help..Dim GW1 As new GridView            GW1 = CType(Me.LoginView1.FindControl("GridView1"), GridView)            If GW1.PageCount < 1 Then                lblFromDept.Visible = True                ddlFromDept.Visible = True                SelectedFromDept.Visible = False                btnOK.Visible = True            Else                lblFromDept.Visible = False                ddlFromDept.Visible = False                SelectedFromDept.Visible = False                btn

Object reference not set to an instance of an object.

  
When  can debugg the code it will give the error "Object reference not set to an instance of an object.". The code is--     using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using SMC.AlphaAccounting.EntryControls; using SMC.AlphaAccounting.PlugIns; using SMC.PlugInContracts; using SMC.BusinessObjects; using SMC.Utils; using SMC; using SMC.AlphaAccounting; using SMC.AlphaAccounting.DataEntry; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinMaskedEdit; using Infragistics.Win.UltraWinToolbars; namespace WindowsApplication3 {     public partial class FormCountry : SmcDataEntry     {         private boGlChart boLocalGlChart;         private boVendors boLocalVendors;         public FormCountry()         {             InitializeComponent();             this.ultraNumericUniqueID.KeyDown += new KeyEventHandler(ultraNumericUniqueID_KeyDown);             this.ultraNumericUniqueID.KeyPress &

Object reference not set to an instance of an object.

  
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs)         Dim CUW1 As New CreateUserWizard         CUW1 = CType(Me.LoginView1.FindControl("CreateUserWizard1"), CreateUserWizard)         Dim p As ProfileCommon = DirectCast(ProfileCommon.Create(CUW1.UserName, True), ProfileCommon)         p.SelectFromDept = DirectCast(CUW1.CreateUserStep.ContentTemplateContainer.FindControl("ddlSelectFromDept"), DropDownList).SelectedValue         p.Save()     End Subanybody can help me with this error?? that error occurs in the p.SelectFromDept line...Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs)        Dim CUW1 As New CreateUserWizard        CUW1 = CType(Me.LoginView1.FindControl("CreateUserWizard1"), CreateUserWizard)        Dim p As ProfileCommon = DirectCast(ProfileCommon.Create(CUW1.UserName, True), ProfileCommon)        p.SelectFromDept = DirectCast(CUW1.CreateUserStep.ContentTemplateContainer.FindControl("ddlSelectFromDept"), DropDownList).SelectedValue        p.Save()    End S

"Object reference not set to an instance of an object."

  
Working in Visual Web Developer 2008 Express Edition, attempting to configure data source (SqlDataSource),  able to include server name: (local)\sqlexpress and the "Test Connection" is successful.  However, when I try to make a new database (or load one of the samples), I keep getting an alert: "Object reference not set to an instance of an object."  I've posted in this forum under "Data Access: Sql Server, Sql Server Express..." with a response to remove and then reinstall VWD and SQL Express.  Thus, I've removed and reinstalled Sql Server 2008.  I tried to remove then reinstall VWD 2008 Express with "Windows Install Clean Up" and "Add / Remove Programs", but in Add/ Remove Programs, it just tried to reinstall without removing then stopped halfway and prompted me to insert a disc (which I don't have since it was an online download).  Not sure what is going on behind the scenes.  Don't know what the problem is as this was never an issue in VWD 2005 Express Edition. Does the problem involve Visual Web Developer 2008 Express Edition or SQL Server 2008?  Any suggestions on removing and then reinstalling VWD 2008 Express?  I feel like I'm missing something simple but after 3 days I'm getting nowhere... As always, help is much appreciated and tha

Object reference not set to an instance of an object.

  
When  can debugg the code it will give the error "Object reference not set to an instance of an object.". The code is--     using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using SMC.AlphaAccounting.EntryControls; using SMC.AlphaAccounting.PlugIns; using SMC.PlugInContracts; using SMC.BusinessObjects; using SMC.Utils; using SMC; using SMC.AlphaAccounting; using SMC.AlphaAccounting.DataEntry; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinMaskedEdit; using Infragistics.Win.UltraWinToolbars; namespace WindowsApplication3 {     public partial class FormCountry : SmcDataEntry     {         private boGlChart boLocalGlChart;         private boVendors boLocalVendors;         public FormCountry()         {             InitializeComponent();             this.ultraNumericUniqueID.KeyDown += new KeyEventHandler(ultraNumericUniqueID_KeyDown);             this.ultraNumericUniqueID.KeyPress &

Object reference not set to an instance of an object error.

  
i've installed the VSeWSS.msi on VS 2005, i'm using SPS 2007, i'm developing on my workstation in C#, i've added the Mircosoft.Sharepointserver dll reference to my project but i still can't deploy a very basic webpart. i get the "Object reference not set to an instance of an object" error but there's no reference to a line, column, project or anyhting. very frustrating. any suggestions/links whould be appreciated.

Login error - Object reference not set to an instance of an object.

  
Hi all,I've set up the login section as a user control. WheneverI log in I get a "Object reference not set to an instance of an object", with the code stopping on this line: if (Membership.ValidateUser(txtUserName.Text,txtPassword.Text))Can anyone tell me how to fix this please?protected void LoginButton_Click(object sender, EventArgs e) { TextBox txtUserName = loggedin.FindControl("UserName") as TextBox; TextBox txtPassword = loggedin.FindControl("Password") as TextBox; CheckBox ckbRememberMe = loggedin.FindControl("RememberMe") as CheckBox; if (Membership.ValidateUser(txtUserName.Text,txtPassword.Text)) { FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, ckbRememberMe.Checked); } else { // Msg.Text = "Login failed. Please check your user name and password and try again."; } } <asp:LoginView ID="loggedin" runat="server"> <AnonymousTemplate> <asp:Login ID="Login1" runat="server"> <LayoutTemplate> <table id="mainbox" width="400"> <tr> <td width="150" class="label">

Error while export to pdf-Object reference not set to an instance of an object

  
Hello, I am getting error while rendering the report to pdf in SSRS 2008. This is happening randomly and sometimes I get this error. I have SQL Server 2008 SP1 installed in my system . I installed the cumulative update 1 for SP1 also but no luck. Every time when export to pdf fails, SSRS is creating the dump file in the logs. I have captured the log of this specific error. Please let me know if you have any idea about this.   reportrendering!ReportServer_0-297!1ec4!03/30/2010-10:32:57:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report., ; Info: Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> System.NullReferenceException: Object reference not set to an instance of an object.   at Microsoft.ReportingServices.Rendering.HPBProcessing.Paragraph.get_SpaceBefore()   at Microsoft.ReportingServices.Rendering.RichText.LineBreaker.FlowParagraph(Paragraph paragraph, Directions direction, IntPtr hdc, Single dpiX, FontCache fontCache, FlowContext flowContext, Boolean keepLines, SizeF flowContextSize, Int32& contentOffset)   at Mi
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend