Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Maintain Session in Home Page

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 474
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: