문제

Why doesn't my page redirect? The "Valid user" prompt pops up. But my page just does not redirect. What can be the issue?

protected void LoginButton_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
User userLogin = new User();
userLogin.userId = this.txtUserName.Text.Trim();
userLogin.userPwd = this.txtPwd.Text.Trim();

string result = CommonFunctions.Check_ValidUser(userLogin);

if (result == "s")
{
Response.Write("<script>alert('" + "Valid user"+ "') ; location.href='Login.aspx'</script>");
Response.Redirect("DrugEntry.aspx",true);
}
else
{
string message = "We don't seem to have this user registered. Please try again.";
Response.Write("<script>alert('" + message + "') ; 
location.href='Login.aspx'</script>");
}
}
}
도움이 되었습니까?

해결책

It seems that your code is correct.

Make sure that your page is in the same directory. If it is not in the same directory that use it as mentioned in below sample :

Response.Redirect("[Directory Name]/DrugEntry.aspx",true);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top