locked
Object reference not set to an instance of an object. RRS feed

  • Question

  •  

    Hi everybody,

     

    I am running aspx page from virtual directory name then i am getting below error.

     

    Can anybody suggest me how to solve this problem?

     

    Thanks

    Prabhakar.

     

    Server Error in '/staff1' 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.]
       _Default.Button1_Click(Object sender, EventArgs e) +96
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

    Wednesday, November 5, 2008 7:24 AM

Answers

  • Prabhakar,

    It frequently happens if the object your program referenced doesn't have a valid GUID.


    Jim
    Jim Wang - MVP Dynamics CRM - http://jianwang.blogspot.com , http://mscrm.cn
    • Marked as answer by Jim Glass Jr Tuesday, March 10, 2009 3:50 PM
    Tuesday, March 10, 2009 1:38 PM
    Moderator

All replies

  • This may sound obvious but a couple of questions.  Have you looked in the Button1_Click method to see what object could be the offender?  Have you set a breakpoint?  Have you looked at the values in the breakpoint?
    Tuesday, March 10, 2009 12:42 AM
  • Prabhakar,

    It frequently happens if the object your program referenced doesn't have a valid GUID.


    Jim
    Jim Wang - MVP Dynamics CRM - http://jianwang.blogspot.com , http://mscrm.cn
    • Marked as answer by Jim Glass Jr Tuesday, March 10, 2009 3:50 PM
    Tuesday, March 10, 2009 1:38 PM
    Moderator