How to redirect to another page after a delay

前端 未结 3 1577
太阳男子
太阳男子 2021-02-15 12:43

I have a sign-in box in my webpage which is inside an UpdatePanel



        
3条回答
  •  花落未央
    2021-02-15 13:15

    You can write a block of Javascript with a delay and redirect to the page with this code

    public void btnSignIn_Click(object sender, EventArgs e)
    {
        lblSSuccess.Text = "We found you, now redirecting...";
        lblSSuccess.ForeColor = ColorTranslator.FromHtml("#037203");
        Session["UseIsAuthenticated"] = "true";
    
        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "redirectJS",
        "setTimeout(function() { window.location.replace('homepage.aspx') }, 5000);", true);
    }
    

提交回复
热议问题