if (Session["admin_uname"].ToString() == "")
{
Response.Redirect("login.aspx");
}
else
{
string userid = Session["admin_uname"].ToString();
}
i have wrote above code for sessions... but problem is if there is any session variable it was working properly
if session is not there it was not redirecting to login page and giving an error like
OBJECT REFERENCE NOT SET.