改成
Page.RegisterStartupScript("Save", "<script> window.alert('保存成功。');document.location.href='abc.aspx'</script>")因为最终执行顺序是先执行完
Response.Redirect("abc.aspx")
再在页面上执行所注册的script的
Page.RegisterStartupScript("Save", "<script> window.alert('保存成功。');document.location.href='abc.aspx'</script>")因为最终执行顺序是先执行完
Response.Redirect("abc.aspx")
再在页面上执行所注册的script的
在没有使用response.flush之前不能确信信息已发送
如果你想警告后再跳转
可以使用javascript的href=或其它javascript指令来实现
也就是你要先将信息发送到客户端,等客户端回应后再请求其它服务器资源
Page.RegisterStartupScript("Save", "<script> window.alert('保存成功。');location.href='abc.aspx';</script>")