protected void Button1_Click(object sender, EventArgs e){Session["uid"] = uname.Text.ToString();Session["pwd"] = pwd.Text.ToString();Server.Transfer("loginmid.aspx"); }
static string strConnection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;SqlConnection objConnection = new SqlConnection(strConnection);SqlDataAdapter da;DataTable dt = new DataTable();DataSet ds = new DataSet();string dq = "select * from login";int i = 0;int c = 0;int chk;protected void Page_Load(object sender, EventArgs e){da = new SqlDataAdapter(dq, strConnection);ds = new DataSet();da.Fill(ds, "login"); string uid = Session["uid"].ToString();string pwd = Session["pwd"].ToString(); c = ds.Tables["login"].Rows.Count - 1;i = 0;while (i <= c){if (ds.Tables["login"].Rows[i]["password"].ToString() == pwd && ds.Tables["login"].Rows[i]["uid"].ToString() == uid){chk = 1;} i++; }if (chk == 1){Label2.Text = "Welcome " + uid + " You Have Successfully Login ";Session["user"] = uid.ToString();//Session["data"] = "no";/*objConnection.Open();SqlCommand comm = new SqlCommand("delete from tmp where uid=@uid", objConnection);comm.Parameters.AddWithValue("@uid", user);comm.ExecuteNonQuery();objConnection.Close();*/}else{Label2.Text = "Try Again";}}
protected void Page_Load(object sender, EventArgs e){if (Session["user"] == null){lblw.Text = "Welcome Guest!";hpcart.Visible = false;}else{lblw.Text = "Welcom " + Session["user"].ToString()+ "!!";hpsin.Text = "Sign Out |"; hpsin.NavigateUrl = "signout.aspx";hpcart.Visible = true;}}