고객이 사용자 이름과 암호를 입력하면 최종 사용자 또는 회계사로 로그인하기 위해 라디오 버튼을 선택해야합니다. 하지만 최종 사용자 라디오 버튼을 클릭하면 메인 페이지로 다시 리디렉션되지만 company.aspx 페이지에는 다시 리디렉션되지 않습니다. 친절 도움말 -Asp.net : 로그인 리디렉션 실패
내 코드 : company.aspx 뒤에
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
conn.Open();
string checkuser = "select count(*) from Registration where USERNAME='" + TextBoxUsername.Text + "'";
SqlCommand com = new SqlCommand(checkuser, conn);
int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
conn.Close();
if (temp == 1)
{
conn.Open();
string checkPasswordQuery = "Select password from Registration where USERNAME='" + TextBoxUsername.Text + "'";
SqlCommand passComm = new SqlCommand(checkPasswordQuery, conn);
string password = passComm.ExecuteScalar().ToString().Replace(" ", "");
if (password == TextBoxPassword.Text)
{
Session["New"] = TextBoxUsername.Text;
Response.Write("Password is correct");
if (EndUserRadioButton.Checked)
{
Response.Redirect("Company.aspx");
}
else if (AccountantRadioButton.Checked)
{
Response.Redirect("AccountantUploads.aspx");
}
}
else
{
Response.Write("Password is not correct");
}
}
else
{
Response.Write("Username is not correct");
}
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if (EndUserRadioButton.Checked)
{
Response.Redirect("Company.aspx");
}
else if (AccountantRadioButton.Checked)
{
Response.Redirect("AccountantUploads.aspx");
}
}
SQL 주입을 방지 페이지가 다시 홈 페이지로 리디렉션됩니다. – user3806621
죄송합니다. 어떻게해야합니까? –
Company.aspx 페이지 (Page_Load 이벤트)의 코드를 게시 할 수 있습니까? – user3806621