locked
nullreference exception RRS feed

  • Question

  • User802554318 posted

    I get a nullreference exception with the last part of the code.Please help

    Results.InnerHtml = Session["MyData"].ToString();

     

     

    Monday, July 18, 2011 9:47 AM

All replies

  • User-1694870838 posted

    Hi,

    Do you mean that the  Session["MyData"].ToString() is Null?

    Session default value is 10 minutes.

    Could you please display more code in the  forum?

    Best Regards,

    Damon

    Thursday, July 28, 2011 5:31 AM
  • User-366017857 posted

    Hi sekai,

    It meance your session variable has not having any value in it first set some value to it before setting value check it for NULL and then set

    if(Session["MyData"]!=Null)

    {

      //Your code here

    }

    Thursday, July 28, 2011 5:40 AM