Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Can anyone know?


How to validate session?it should identify new user and current user?
Posted

1 solution

after login...
put a condition in your pageload event...like this...

C#
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["User"] == null)
            {
                Response.Redirect("login.aspx");
            }
        }
        if (Session["SessionId"] == null)
        {
            Response.Redirect("login.aspx");
        }
        Response.Buffer = true;
        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
        Response.Expires = -1500;
        Response.CacheControl = "no-cache";
    }
 
Share this answer
 
Comments
sathiyak 6-Dec-11 1:22am    
sry.....not this one...it should find whether it is newuser or currentuser?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900