I get an error when I do the following:
if(Session[\"value\"] != null)
{
// code
}
The error i get is this:
Object reference not
The syntax used by you:
if (Session["mySessionVariable"] != null)
{
}
... is the correct way to check for a Session object in ASP.NET. I suspect that the problem is because you are using ASP.NET MVC.
Maybe some of our MVC experts can enlighten us as to the correct way of doing this in ASP.NET MVC.
Edit: I see that Marc Gravell has posted his answer while I'm typing this. That should be illuminatory.