I have created a class with name Examination, in this class I have a method with name Get Question(), in take exam when i am creating object of Examination and Run Application it gives following error.
NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 18: Examination e = (Examination)Session["questions"];
Line 19: // display data
Line 20: lblSubject.Text = e.sname;
Line 21: lblQno.Text = e.curpos + 1 + "/" + e.SIZE;
Line 22: lblCtime.Text = DateTime.Now.ToString();
eis null, first check whetherSession["questions"]contains data and if it is possible to cast it toExamination.