Hi,
i using mvc5.
how i can check session key is set or not (exist) ?
i do this
if(Session["MyKey"]!=Null){// do something}
but i get error :
Object reference not set to an instance of an object.
try this one:
if(Session["mykey"]!=null && Session["mykey"] !="") { //do my logic } else { //id session["mykey"] is not set redirect RedirectToAction("Index"); }