我有一个HTML表单,通过登录将我重定向到aspx页面:
<form method="post" action="../login.aspx">
Run Code Online (Sandbox Code Playgroud)
如果数据正确,一切正常,但是当数据失败时,我需要显示一条错误消息,我该怎么做?
在aspx页面中,当一切正常时,我有一个重定向,但是当登录失败时,我尝试发送警报并重定向到我的html页面,但这不起作用,用户转到html页面,但警报未显示:
Response.Redirect("~/Users.aspx"); //here everything is ok
}
}
// if the login is wrong
else
{
Response.Write("<script>alert(the login is wrong);</script>");
Response.Redirect(Request.UrlReferrer.ToString());
}
Run Code Online (Sandbox Code Playgroud)