代码如下:
        Response.Write("<script>alert('您目前不能登录此系统!')</script>");
        Response.Redirect("~/Login.aspx");
上面一句总是执行不了,我给它换成RegisterStartupScript或者RegisterClientScriptBlock也不行。不过将后面一句代码删除之后,还是可以弹出提示框来,谁能告诉我这是为什么?怎么写才可以弹出提示框,然后跳转到另一个页面?

解决方案 »

  1.   

    因为页面转向了,如下修改,注意转向路径
    this.RegisterStartupScript("Awoke", "<script>alert('您目前不能登录此系统!');window.location.href='Login.aspx';</script>");
      

  2.   

    Response.Redirect("~/Login.aspx");  没等到 Response.Write("<script>alert('您目前不能登录此系统!')</script>"); 就直接跳转走了
      

  3.   

    this.RegisterStartupScript(this.getType(),"", "alert('您目前不能登录此系统!');window.location.href='Login.aspx';",true);