Object reference not set

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hhcmxpZSBK?=, Mar 10, 2006.

  1. I have a real stumper. I added a server side table to a home page that has
    two other server side tables on it that have been working great. In Visual
    Studio everything works great. When I put the page on the production server,
    the first time in the page works great. If I navigate to any other page on
    the site and then try to return to the home page the control I added throws
    the following:

    Server Error in '/' 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.]
    MAFE.home.LoadBWOM()
    MAFE.home.Page_Load(Object sender, EventArgs e)
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +35
    System.Web.UI.Page.ProcessRequestMain() +761

    If I comment out the line of code where I store a row in the new table, all
    works just fine. Anyone have any ideas?

    --
    Charlie Jursch
    Patotech Software, Inc.
    Danville, CA
     
    =?Utf-8?B?Q2hhcmxpZSBK?=, Mar 10, 2006
    #1
    1. Advertising

  2. can you show us the line of code that you comment out to make it work, and
    all relevant lines of code? Clearly something's null. It's easy to debug if
    you step through it and add a breakpoint on that line...

    Karl

    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "Charlie J" <> wrote in message
    news:...
    >I have a real stumper. I added a server side table to a home page that has
    > two other server side tables on it that have been working great. In
    > Visual
    > Studio everything works great. When I put the page on the production
    > server,
    > the first time in the page works great. If I navigate to any other page
    > on
    > the site and then try to return to the home page the control I added
    > throws
    > the following:
    >
    > Server Error in '/' 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.]
    > MAFE.home.LoadBWOM()
    > MAFE.home.Page_Load(Object sender, EventArgs e)
    > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > System.Web.UI.Control.LoadRecursive() +35
    > System.Web.UI.Page.ProcessRequestMain() +761
    >
    > If I comment out the line of code where I store a row in the new table,
    > all
    > works just fine. Anyone have any ideas?
    >
    > --
    > Charlie Jursch
    > Patotech Software, Inc.
    > Danville, CA
     
    Karl Seguin [MVP], Mar 10, 2006
    #2
    1. Advertising

  3. Charlie, you may wish to read the reply I made to your original post - I
    crossposted it to this group so it still has the original subject: "Re:
    ASP.NET Problem with return to home page".
    The conversation about this topic should, of course, continue in this
    thread. I just wanted to draw your attention to what I said.

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Mar 10, 2006
    #3
  4. Here is the line of code:

    tdBWOM.InnerHtml = sb1.ToString();

    In an attempt to isolate what is happening, I changed the html file to use a
    html table instead of an asp:Table. I get the same result.

    I cannot get this to fail on my test system, only on the production server.
    When the page first displays, the text I put in the cell displays perfectly.
    There is no error. Only when I navigate to another page on the site and then
    navigate back to this page do I get the error. If you want to see the aspx
    page after it is generated, go to www.mafe.org. It is the home page for the
    site (default.aspx) that I am having the problem with. I currently have the
    line of code above commented out in the code behind file.
    --
    Charlie Jursch
    Patotech Software, Inc.
    Danville, CA


    "Karl Seguin [MVP]" wrote:

    > can you show us the line of code that you comment out to make it work, and
    > all relevant lines of code? Clearly something's null. It's easy to debug if
    > you step through it and add a breakpoint on that line...
    >
    > Karl
    >
    > --
    > http://www.openmymind.net/
    > http://www.fuelindustries.com/
    >
    >
    > "Charlie J" <> wrote in message
    > news:...
    > >I have a real stumper. I added a server side table to a home page that has
    > > two other server side tables on it that have been working great. In
    > > Visual
    > > Studio everything works great. When I put the page on the production
    > > server,
    > > the first time in the page works great. If I navigate to any other page
    > > on
    > > the site and then try to return to the home page the control I added
    > > throws
    > > the following:
    > >
    > > Server Error in '/' 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.]
    > > MAFE.home.LoadBWOM()
    > > MAFE.home.Page_Load(Object sender, EventArgs e)
    > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > System.Web.UI.Control.LoadRecursive() +35
    > > System.Web.UI.Page.ProcessRequestMain() +761
    > >
    > > If I comment out the line of code where I store a row in the new table,
    > > all
    > > works just fine. Anyone have any ideas?
    > >
    > > --
    > > Charlie Jursch
    > > Patotech Software, Inc.
    > > Danville, CA

    >
    >
    >
     
    =?Utf-8?B?Q2hhcmxpZSBK?=, Mar 10, 2006
    #4
  5. Bob,

    Thanks for your input. I have updated the web.config accordingly.
    --
    Charlie Jursch
    Patotech Software, Inc.
    Danville, CA


    "Bob Barrows [MVP]" wrote:

    > Charlie, you may wish to read the reply I made to your original post - I
    > crossposted it to this group so it still has the original subject: "Re:
    > ASP.NET Problem with return to home page".
    > The conversation about this topic should, of course, continue in this
    > thread. I just wanted to draw your attention to what I said.
    >
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    >
     
    =?Utf-8?B?Q2hhcmxpZSBK?=, Mar 10, 2006
    #5
  6. You still have not shown enough code to enable us to see what's happening.
    All I can say is that you should determine which object it is complaining
    about: tdBWOM or sb1. Insert some code to verify that both of these
    variables are set to the appropriate objects.
    You should do this before posting more code. :)

    Bob Barrows
    Charlie J wrote:
    > Here is the line of code:
    >
    > tdBWOM.InnerHtml = sb1.ToString();
    >
    > In an attempt to isolate what is happening, I changed the html file
    > to use a html table instead of an asp:Table. I get the same result.
    >
    > I cannot get this to fail on my test system, only on the production
    > server. When the page first displays, the text I put in the cell
    > displays perfectly. There is no error. Only when I navigate to
    > another page on the site and then navigate back to this page do I get
    > the error. If you want to see the aspx page after it is generated,
    > go to www.mafe.org. It is the home page for the site (default.aspx)
    > that I am having the problem with. I currently have the line of code
    > above commented out in the code behind file. --
    > Charlie Jursch
    > Patotech Software, Inc.
    > Danville, CA
    >
    >
    > "Karl Seguin [MVP]" wrote:
    >
    >> can you show us the line of code that you comment out to make it
    >> work, and all relevant lines of code? Clearly something's null.
    >> It's easy to debug if you step through it and add a breakpoint on
    >> that line...
    >>
    >> Karl
    >>
    >> --
    >> http://www.openmymind.net/
    >> http://www.fuelindustries.com/
    >>
    >>
    >> "Charlie J" <> wrote in message
    >> news:...
    >>> I have a real stumper. I added a server side table to a home page
    >>> that has two other server side tables on it that have been working
    >>> great. In Visual
    >>> Studio everything works great. When I put the page on the
    >>> production server,
    >>> the first time in the page works great. If I navigate to any other
    >>> page on
    >>> the site and then try to return to the home page the control I added
    >>> throws
    >>> the following:
    >>>
    >>> Server Error in '/' 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.]
    >>> MAFE.home.LoadBWOM()
    >>> MAFE.home.Page_Load(Object sender, EventArgs e)
    >>> System.Web.UI.Control.OnLoad(EventArgs e) +67
    >>> System.Web.UI.Control.LoadRecursive() +35
    >>> System.Web.UI.Page.ProcessRequestMain() +761
    >>>
    >>> If I comment out the line of code where I store a row in the new
    >>> table, all
    >>> works just fine. Anyone have any ideas?
    >>>
    >>> --
    >>> Charlie Jursch
    >>> Patotech Software, Inc.
    >>> Danville, CA


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Mar 10, 2006
    #6
  7. agreed.

    If that's the line, it's clear that either sb is null or tdBWOM is null.

    Karl

    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > You still have not shown enough code to enable us to see what's happening.
    > All I can say is that you should determine which object it is complaining
    > about: tdBWOM or sb1. Insert some code to verify that both of these
    > variables are set to the appropriate objects.
    > You should do this before posting more code. :)
    >
    > Bob Barrows
    > Charlie J wrote:
    >> Here is the line of code:
    >>
    >> tdBWOM.InnerHtml = sb1.ToString();
    >>
    >> In an attempt to isolate what is happening, I changed the html file
    >> to use a html table instead of an asp:Table. I get the same result.
    >>
    >> I cannot get this to fail on my test system, only on the production
    >> server. When the page first displays, the text I put in the cell
    >> displays perfectly. There is no error. Only when I navigate to
    >> another page on the site and then navigate back to this page do I get
    >> the error. If you want to see the aspx page after it is generated,
    >> go to www.mafe.org. It is the home page for the site (default.aspx)
    >> that I am having the problem with. I currently have the line of code
    >> above commented out in the code behind file. --
    >> Charlie Jursch
    >> Patotech Software, Inc.
    >> Danville, CA
    >>
    >>
    >> "Karl Seguin [MVP]" wrote:
    >>
    >>> can you show us the line of code that you comment out to make it
    >>> work, and all relevant lines of code? Clearly something's null.
    >>> It's easy to debug if you step through it and add a breakpoint on
    >>> that line...
    >>>
    >>> Karl
    >>>
    >>> --
    >>> http://www.openmymind.net/
    >>> http://www.fuelindustries.com/
    >>>
    >>>
    >>> "Charlie J" <> wrote in message
    >>> news:...
    >>>> I have a real stumper. I added a server side table to a home page
    >>>> that has two other server side tables on it that have been working
    >>>> great. In Visual
    >>>> Studio everything works great. When I put the page on the
    >>>> production server,
    >>>> the first time in the page works great. If I navigate to any other
    >>>> page on
    >>>> the site and then try to return to the home page the control I added
    >>>> throws
    >>>> the following:
    >>>>
    >>>> Server Error in '/' 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.]
    >>>> MAFE.home.LoadBWOM()
    >>>> MAFE.home.Page_Load(Object sender, EventArgs e)
    >>>> System.Web.UI.Control.OnLoad(EventArgs e) +67
    >>>> System.Web.UI.Control.LoadRecursive() +35
    >>>> System.Web.UI.Page.ProcessRequestMain() +761
    >>>>
    >>>> If I comment out the line of code where I store a row in the new
    >>>> table, all
    >>>> works just fine. Anyone have any ideas?
    >>>>
    >>>> --
    >>>> Charlie Jursch
    >>>> Patotech Software, Inc.
    >>>> Danville, CA

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    Karl Seguin [MVP], Mar 10, 2006
    #7
  8. .... which leaves unanswered the question of why one of them is null, which
    can best be answered by stepping through the code (not recommended in a
    production environment, but a duplicate app could be created for testing, I
    suppose). If stepping is not an option, then you have to manually backtrace
    the lines of code leading up to this line and see if you can identify the
    failure to instantiate the object.


    Karl Seguin [MVP] wrote:
    > agreed.
    >
    > If that's the line, it's clear that either sb is null or tdBWOM is
    > null.
    >
    > Karl
    >
    > --
    > http://www.openmymind.net/
    > http://www.fuelindustries.com/
    >
    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    >> You still have not shown enough code to enable us to see what's
    >> happening. All I can say is that you should determine which object
    >> it is complaining about: tdBWOM or sb1. Insert some code to verify
    >> that both of these variables are set to the appropriate objects.
    >> You should do this before posting more code. :)
    >>
    >> Bob Barrows
    >> Charlie J wrote:
    >>> Here is the line of code:
    >>>
    >>> tdBWOM.InnerHtml = sb1.ToString();
    >>>
    >>> In an attempt to isolate what is happening, I changed the html file
    >>> to use a html table instead of an asp:Table. I get the same result.
    >>>
    >>> I cannot get this to fail on my test system, only on the production
    >>> server. When the page first displays, the text I put in the cell
    >>> displays perfectly. There is no error. Only when I navigate to
    >>> another page on the site and then navigate back to this page do I
    >>> get the error. If you want to see the aspx page after it is
    >>> generated, go to www.mafe.org. It is the home page for the site
    >>> (default.aspx) that I am having the problem with. I currently have
    >>> the line of code above commented out in the code behind file. --
    >>> Charlie Jursch
    >>> Patotech Software, Inc.
    >>> Danville, CA
    >>>
    >>>
    >>> "Karl Seguin [MVP]" wrote:
    >>>
    >>>> can you show us the line of code that you comment out to make it
    >>>> work, and all relevant lines of code? Clearly something's null.
    >>>> It's easy to debug if you step through it and add a breakpoint on
    >>>> that line...
    >>>>
    >>>> Karl
    >>>>
    >>>> --
    >>>> http://www.openmymind.net/
    >>>> http://www.fuelindustries.com/
    >>>>
    >>>>
    >>>> "Charlie J" <> wrote in message
    >>>> news:...
    >>>>> I have a real stumper. I added a server side table to a home page
    >>>>> that has two other server side tables on it that have been working
    >>>>> great. In Visual
    >>>>> Studio everything works great. When I put the page on the
    >>>>> production server,
    >>>>> the first time in the page works great. If I navigate to any
    >>>>> other page on
    >>>>> the site and then try to return to the home page the control I
    >>>>> added throws
    >>>>> the following:
    >>>>>
    >>>>> Server Error in '/' 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.]
    >>>>> MAFE.home.LoadBWOM()
    >>>>> MAFE.home.Page_Load(Object sender, EventArgs e)
    >>>>> System.Web.UI.Control.OnLoad(EventArgs e) +67
    >>>>> System.Web.UI.Control.LoadRecursive() +35
    >>>>> System.Web.UI.Page.ProcessRequestMain() +761
    >>>>>
    >>>>> If I comment out the line of code where I store a row in the new
    >>>>> table, all
    >>>>> works just fine. Anyone have any ideas?
    >>>>>
    >>>>> --
    >>>>> Charlie Jursch
    >>>>> Patotech Software, Inc.
    >>>>> Danville, CA

    >>
    >> --
    >> Microsoft MVP -- ASP/ASP.NET
    >> Please reply to the newsgroup. The email account listed in my From
    >> header is my spam trap, so I don't check it very often. You will get
    >> a quicker response by posting to the newsgroup.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Mar 10, 2006
    #8
  9. I resolved this issue by upgrading the application to APS.NET 2.0. This all
    started to happen right after I had installed 2.0 on the servers. I cannot
    explain why it was happening, only that after I converted the application to
    2.0 everything started to work normally.

    Thanks for your assistance.
    --
    Charlie Jursch
    Patotech Software, Inc.
    Danville, CA


    "Charlie J" wrote:

    > I have a real stumper. I added a server side table to a home page that has
    > two other server side tables on it that have been working great. In Visual
    > Studio everything works great. When I put the page on the production server,
    > the first time in the page works great. If I navigate to any other page on
    > the site and then try to return to the home page the control I added throws
    > the following:
    >
    > Server Error in '/' 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.]
    > MAFE.home.LoadBWOM()
    > MAFE.home.Page_Load(Object sender, EventArgs e)
    > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > System.Web.UI.Control.LoadRecursive() +35
    > System.Web.UI.Page.ProcessRequestMain() +761
    >
    > If I comment out the line of code where I store a row in the new table, all
    > works just fine. Anyone have any ideas?
    >
    > --
    > Charlie Jursch
    > Patotech Software, Inc.
    > Danville, CA
     
    =?Utf-8?B?Q2hhcmxpZSBK?=, Mar 13, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Parthiv Joshi
    Replies:
    2
    Views:
    702
    Kalyan
    Jul 2, 2004
  2. Suresh Kojhani
    Replies:
    1
    Views:
    2,398
    Anushi
    Jul 29, 2004
  3. Chris Fink
    Replies:
    2
    Views:
    4,111
    David Waz...
    Jul 3, 2003
  4. yysiow
    Replies:
    1
    Views:
    445
    Kevin Spencer
    Jul 12, 2003
  5. Replies:
    1
    Views:
    488
    Mark Rae [MVP]
    Sep 20, 2007
Loading...

Share This Page