try { Session["ename"] = TextBox1.Text; cn.Open(); SqlCommand SqlCmd = new SqlCommand("SELECT * FROM empregd WHERE ename='" + TextBox1.Text + "' AND password='" + TextBox2.Text + "'", cn); SqlDataAdapter SqlDa = new SqlDataAdapter(SqlCmd); SqlDataReader SqlDr = SqlCmd.ExecuteReader(); if (SqlDr.Read()) { Response.Redirect("http://localhost:49871/WebSite7/Default6.aspx"); } SqlDr.Close(); cn.Close(); TextBox1.Text = ""; TextBox2.Text = ""; } catch (Exception ex) { throw ex; }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["ename"]== null) { Response.Redirect("http://localhost:49871/WebSite7/Default5.aspx"); } Label2.Text = Session["ename"].ToString(); } catch (Exception ex) { throw ex; } } protected void Button1_Click(object sender, EventArgs e) { try { Response.Redirect("http://localhost:49871/WebSite7/Default5.aspx"); FormsAuthentication.SignOut(); Session.Abandon(); Session.Clear(); Session["ename"] = null; } catch (Exception ex) { throw ex; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)