Witam !
Mam taki problem. Tworzę system logowania.
Po pomyślnym zweryfikowaniu użytkownika ustalam dwa parametry sesji.
Następnie użytkownik ma możliwość kliknięcia w przycisk, który przekieruje go na inną stronę ( w tym przypadku stronę gdzie będzie mógł edytować swoje dane).
W evencie przycisku nie ma nic innego oprócz: Response.Redirect("blah.aspx");
Po kliknięciu w przycisk strona odświeża się ale nie przekierowuje !!!
Próbowałem już:
Response.Redirect("blah.aspx");
Response.Redirect("blah.aspx", flase);
Response.Redirect("blah.aspx", true);
Server.Transfer("blah.aspx");
Server.Transfer("blah.aspx", true);
Server.Transfer("blah.aspx", false);
Za każdym razem dzieje się to samo.
Jeżeli usunę ustalanie parametrów sesji to przekierowanie działa.
Jak mogę to naprawić lub obejść . Bardzo proszę o pomoc.
To jest try catch z weryfikacją użytkownika.
try
{
conn.Open();
cmd.ExecuteNonQuery();
loginReader = cmd.ExecuteReader();
if (loginReader.HasRows)
{
while (loginReader.Read())
{
userId = loginReader["user_ID"].ToString();
name = loginReader["name"].ToString();
surname = loginReader["surname"].ToString();
accountType = loginReader["account_type"].ToString();
}
LabelLogin.Visible = false;
LabelLoggedin.Visible = true;
if (accountType == "customer") { ButtonManageUsers.Visible = false; }
LabelName.Text = name;
LabelSurname.Text = surname;
Session["id"] = userId;
Session["accountType"] = accountType;
}
else
{
ErrorOutput.Text = "Wrong username or password !";
}
}
catch (SqlException ex)
{
ErrorOutput.Text ="Error"+ ex;
}
finally
{
conn.Close();
}
A to sam event buttona:
protected void ButtonManageUsers_Click(object sender, EventArgs e)
{
Server.Transfer("ManageUsers.aspx");
}