HttpContext.Current.Response.Write("<script>alert('已退出');window.location.href ='login.aspx';</script>");
或者
public static void MsgToUrl(string msg, string url)
{
HttpContext.Current.Response.Write("<script>alert('" + msg + "');window.location.href ='" + url + "';</script>");
}
调用
CommonOperation.MsgToUrl("未登录", "login.aspx");
注:CommonOperation类名。