比如有个页面 a.aspx 是通过 m 这个母版页生成的,在 a 的 page_load 里我写了个判断,如果不成立的话就弹出对话框并跳转,大致是通过如下方法实现的
 public static void AlertAndRedirect(Page page, string msg, string url)
            {
                page.ClientScript.RegisterClientScriptBlock(page.GetType(), "alert", "document.open();window.alert('" + msg + "'); location.replace('" + url + "');document.close();", true);
            }现在发现通过这样的方法,程序还会执行 master 页面 page_load 内的代码,我的本意是如果条件不成立,就中断后面所有的执行,请问大侠应该怎么处理这类问题?谢谢

解决方案 »

  1.   

     Response.Redirect("http://www.sina.com");
      

  2.   

    不要在a里写,要在master 里写.a怎么可能阻止master 的代码
      

  3.   

    公共部分写在
    master 页面 page_load里各页面自己功能 写在自己页面里
      

  4.   

      Response.Write("<script>window.alert('该会员没有提交申请,请重新提交!');window.location='http://www.gongxinkang.com.cn' </script>");
            Response.End();