/// <summary> /// 提示错误信息!操作回滚! /// </summary> /// <param name="msg"></param> /// <param name="code"></param> public static void Show_Msg(string msg) { HttpContext.Current.Response.Write("<script>alert(\"" + msg + "\");history.back();</script>"); HttpContext.Current.Response.End(); } /// <summary> /// 提示成功信息!转向! /// </summary> /// <param name="msg"></param> /// <param name="url"></param> public static void Show_Msg(string msg, string url) { HttpContext.Current.Response.Write("<script>alert(\"" + msg + "\");location.href='" + url + "';</script>"); }
--------------调用
show_msg("参数错误","abc.aspx");
show_msg("提交成功","def.aspx");