Hi all,

I've hosted my application at shared server. So, after 10 - 15 minutes my session object "userid" is expiring and throwing error "Session object userid is not instantiated"

I want to check my session object exists or not.
I've already used if(Session["useid"]=="") but it is throwing error. Is there any method in C#, ASP .Net like isset(object name) method in PHP.

Thanks,
Lokesh Sharma

There are 2 steps:
1. declare parent page (superclass)

public class ParentPage : Page
{
protected override void OnLoad(EventArgs e)
    {
       objLoginUser = (Users)Session["LOGINUSER"];
       if (Session["LOGINUSER"] == null) {
// you got no logged or session expired...refirect etc.
    }  //end if
  }
}

And other step is your_page : ParentPage May be all you are asking for is == null (in c#)

please close thread if that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.