I have this code
protected void loginbutton_Click(object sender, EventArgs e)
{
Int32 d = checkuser(uid.Text, pwd.Text);
if (d == -1)
{
prompt.Visible = true;
prompt.Text = "Unregistered ID. Please make sure that you have a registered account and you have correctly typed in the user ID";
}
else if (d == 1)
{
Server.Transfer("Enrollment.aspx");
}
else if (d == -2)
{
prompt.Visible = true;
prompt.Text = "Incorrect password. Please try again.";
}
}
private Int32 checkuser(string u, string p)
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_checkuser";
cmd.Connection = con;
cmd.Parameters.Add("@uid", SqlDbType.NVarChar).Value = uid.Text;
cmd.Parameters.Add("@pwd", SqlDbType.NVarChar).Value = pwd.Text;
SqlParameter p1 = new SqlParameter("@ret", SqlDbType.Int);
p1.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(p1);
con.Open();
cmd.ExecuteNonQuery();
Int32 k = Convert.ToInt32(cmd.Parameters["@ret"].Value);
return k;
}
for transferring the user to the desired page when he/she login. What I need to do is the logout. The user must not be able to go back to the previous page when he/she choose to logout.