比如有个页面 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 内的代码,我的本意是如果条件不成立,就中断后面所有的执行,请问大侠应该怎么处理这类问题?谢谢
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 内的代码,我的本意是如果条件不成立,就中断后面所有的执行,请问大侠应该怎么处理这类问题?谢谢
master 页面 page_load里各页面自己功能 写在自己页面里
Response.End();