Session disappears on return to home page

shorunmu

New Member
I have a web site running on Azure where a user can login then navigate to other pages (naturally). My problem is that when I return to the Index/Homepage the session just disappears. I thought it my have something to do with the login control and its authentication method in the code behind but I tried putting another login on another page with the same authenticate event but that is completely fine.I haven't found anyone with a similar problem.here is the code behind for index.aspx\[code\]string Connection = ConfigurationManager.ConnectionStrings["****"].ConnectionString;protected void Page_Load(object sender, EventArgs e) {}protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string Username = Login1.UserName; string pwd = Login1.Password; SqlConnection connection = new SqlConnection(Connection); connection.Open(); //SqlCommand comm = new SqlCommand("SELECT COUNT([*****], [*****]) FROM ***** WHERE [****] = '***' AND [****] = '****'", connection); string sqlUserName = "SELECT [****] ,[****] FROM ***** WHERE [*****] ='" + * * * * * +"' AND [*****] ='" + * * * +"'"; SqlCommand cmd = new SqlCommand(sqlUserName, connection); string CurrentName; CurrentName = (string) cmd.ExecuteScalar(); if(CurrentName != null) { Login1.FailureText = "Welcome"; Session["User"] = Username; Session["LoggedIn"] = true; Label1.Text = Session["User"].ToString(); if((bool) Session["LoggedIn"] == true && Session["User"].ToString() == "admin1") { HyperLink3.Visible = true; } else if((bool) Session["LoggedIn"] == true) { HyperLink1.Visible = true; } } else { Session["User"] = ""; }}}\[/code\]
 
Back
Top