/// <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");
Asp.net 页面返回到上一页面
本文介绍了一种在 ASP.NET 应用中处理异常的方法,通过使用 Show_Msg 方法显示错误消息并进行页面跳转或回退,确保了用户体验的同时也便于开发者定位问题。


被折叠的 条评论
为什么被折叠?



