在我的页面上用了UpdatePanel控件,我想在访问这个页面或者是这个页面有提交服务的时候去判断用户是否登录.
protected void Page_Load(object sender, EventArgs e)
{
if (sm.UserName == "guest")
{
System.Web.UI.ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "", "alert('登录超时!');window.parent.location.href='http://127.0.0.1';", true);
//Response.End();
return;
}
}如果加上Response.End();这样页面就无法跳转到'http://127.0.0.1'了,但如果去掉的话,我点提交的时候这个页面的数据还是会提交到数据库然后再跳转,
怎么能让他在没有登录的情况下直接跳转而不去提交呢
protected void Page_Load(object sender, EventArgs e)
{
if (sm.UserName == "guest")
{
System.Web.UI.ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "", "alert('登录超时!');window.parent.location.href='http://127.0.0.1';", true);
//Response.End();
return;
}
}如果加上Response.End();这样页面就无法跳转到'http://127.0.0.1'了,但如果去掉的话,我点提交的时候这个页面的数据还是会提交到数据库然后再跳转,
怎么能让他在没有登录的情况下直接跳转而不去提交呢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货