Click here to Skip to main content
16,004,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
protected void LinkButton3_Click(object sender, EventArgs e)
    {
        string connStr = ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;
        SqlConnection con = new SqlConnection(connStr);
        con.Open();
        string dat =Convert.ToString( DateTime.Now.ToShortDateString());
        SqlCommand cmd = new SqlCommand("update LoginData set LogoutTime='" + dat+ "' where LogSession='" + sessionlog + "'", con);
        cmd.ExecuteNonQuery();
        con.Close();
        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert(' You Are Now Logged Out....');", true);
        Response.Redirect("main.aspx");
     
     }
Posted
Updated 11-Feb-13 2:58am
v2

It doesn't look like you are clearing the authentication cookie.
 
Share this answer
 
Comments
shoaib_ferrari 11-Feb-13 11:06am    
How do you clear that?? I am new to programming...any help pls
Matthew Dennis 11-Feb-13 11:09am    
try searching for ASP.NET Membership
http://www.codeproject.com/search.aspx?q=asp.net+membership&sbo=kw&x=0&y=0
I am assuming that if browser back button is clicked after LOGOUT is clicked, application is going back into the application without asking credentials. Take a look at following links, hope they help you:
Browser back button issue after logout[^]
Browser Back Button issue[^]
how to prevent back button after logout in asp.net[^]
 
Share this answer
 
Comments
shoaib_ferrari 11-Feb-13 9:47am    
Thanks Vani...but i tried all the methods but still not able to solve the issue

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