Dhruvi kukadiya

Dhruvi kukadiya

  • NA
  • 20
  • 11.4k

object reference not set to an instance of an object.

Dec 23 2014 9:31 PM
When i run below code it gives "object reference not set to an instance of an object."Exception on first line.


if ((context.Session["ImageBytes"]) != null)
        {
            byte[] image = (byte[])(context.Session["ImageBytes"]);
            context.Response.ContentType = "image/JPEG";
            context.Response.BinaryWrite(image);
        }

Answers (4)