tags:

views:

49

answers:

1

The exception:

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.RaisePostBackEvent(NameValueCollection postData) +36   

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563   


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1  

The Source Code of the File is:

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)   
        {   

            //Response.Write("<script language=javascript>alert('Daten gesendet');</script>");   

            int first = 1;   
            foreach(ListViewItem item in ListView1.Items)   
            {   
                HiddenField hidden = (HiddenField) item.FindControl("Hidden1_id");   
                Label label = (Label) item.FindControl("Label_anzahl");   

                if (first == 1)   
                {   
                    try   
                    {   
                        _ax.CreateOrderLine(hidden.Value.ToString(), "Begin", Convert.ToDouble(label.Text.ToString()));    
                    }   
                    catch (Exception ex)   
                    {   
                        string fehler_ausgabe = "<script language=javascript>alert('Fehler beim aufrufen von CreateOrderLine');</script>";   
                        Response.Write(fehler_ausgabe);   
                    }   

                    first = 0;   
                }   
                else   
                {   
                    try   
                    {   
                        _ax.CreateOrderLine(hidden.Value.ToString(), "Continue", Convert.ToDouble(label.Text.ToString()));    
                    }   
                    catch (Exception ex)   
                    {   

                    }   
                }   

            }   
            try   
            {   
                _ax.CreateOrderLine("1009", "End", 1);   
            }   
            catch (Exception ex)   
            {   

            }   

        }  

Why do this error only come on IIS6?

A: 

The ListView1 is in the same page. but not in the code behind cs (in the aspx)

mullek
While this may look like a forum, it is not. Answers are upvoted and downvoted, and change position. So your comment may appear out of order when this page later. I recommend adding a comment to one of the provided answers.
Daniel Joseph