While using sessions user must have to be cautious while invoking and destroying it
When user login into the page session gets created from the database details
Ex : session["userid"]=obj.getsessionid();
While logout we must destroy this session
Ex : Session.RemoveAll();
If anyone tries to go into the home page of the user by just typing the home.aspx page in the URL
we also need to handle that
Ex: if (Session["id"] != null)
{
userdetobj.id = Convert.ToInt32(Session["id"]);
spanmessage.InnerHtml = dtrepobj.GetUserName(userdetobj);
}
else
{
Response.Redirect("~/Login.aspx");
}
0 Comment(s)