My problem is for postItem.aspx and giveComment.aspx, users cannot access without login.
Can i use the nested-if method? Then how to use it? Thank you...
In Login.aspx.cs
if (temp == 1)
{
string cmdStr2 = "Select Password from Reg where Username= '" + txtUN.Text + "'";
SqlCommand pass = new SqlCommand(cmdStr2, con);
string Password = pass.ExecuteScalar().ToString();
con.Close();
if (Password == txtPass.Text)
{
if("current page"==postItem.aspx){
Session["New"] = txtUN.Text;
Response.Redirect("postItem.aspx");
}
}
if(Password == txtPass.Text)
{
if("current page"==giveComment.aspx){
Session["New"] = txtUN.Text;
Response.Redirect("giveComment.aspx");
}
}
In postItem.aspx.cs
if (Session["New"] != null)
{
Label1.Text += Session["New"].ToString();
}
else
{
Response.Redirect("Login.aspx");
}
In giveComment.aspx.cs
if (Session["New"] != null)
{
Label1.Text += Session["New"].ToString();
}
else
{
Response.Redirect("Login.aspx");
}
**I want to make it likes if users now in postItem.aspx and without login then after he/she login then it will redirect to postItem.aspx.
On the hands, if users now in giveComment.aspx and without login then after he/she login then it will redirect to giveComment.aspx.
Thank you... :)