汗....我的意思是说,大致怎么实现的?比如是转到一个提示错误的页,还是alert()之类的...

解决方案 »

  1.   

    个人感觉最好就是放个Label用于显示错误消息,不要弹来弹去的,省得浏览器提意见。
      

  2.   

    response.write("<script>alert('用户或密码错误');location.href='页面名称';</script>")
      

  3.   


    使用Label都可以。登陆页面一般的数据都不应该很大吧
      

  4.   

    我是放在类库中进行处理的:
    /// <summary>
            /// 显示信息提示对话框  2007-3-23
            /// </summary>
            /// <param name="curPage">当前页面指针,一般为this</param>
            /// <param name="msg">提示信息</param>
            public static void ShowMsg(System.Web.UI.Page curPage, string msg)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");
                else if (msg == null)
                    throw new ArgumentNullException("msg");
                else
                {
                    Type cstype = curPage.GetType();
                    curPage.ClientScript.RegisterStartupScript(cstype, "dd", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
                }
            } /// <summary>
            /// 控件点击信息确认提示框 2007-3-23
            /// </summary>
            /// <param name="curPage">当前控件指针</param>
            /// <param name="msg">弹出信息</param>
            public static void ShowConfirm(System.Web.UI.WebControls.WebControl curPage, string msg)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");
                else
                    curPage.Attributes.Add("onclick", "return confirm('" + msg + "');");
            } /// <summary>
            /// 显示信息提示对话框并进行页面跳转 2007-3-23
            /// </summary>
            /// <param name="curPage">当前页面指针,一般为this</param>
            /// <param name="msg">提示信息</param>
            /// <param name="reurl">跳转的目标URL</param>
            public static void ShowAndRedirect(System.Web.UI.Page curPage, string msg, string reurl)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");
                else if (msg == null)
                    throw new ArgumentNullException("msg");
                else if (reurl == null)
                    throw new ArgumentNullException("reurl");
                else
                {
                    StringBuilder Builder = new StringBuilder();
                    Type cstype = curPage.GetType();
                    //使用StringBuilder类来创建字符串,StringBuilder类位于命名空间System.Text
                    //对字符串可以做一些基本的操作,比如Append、Replace、Insert、Remove等
                    Builder.Append("<script language='javascript' defer>");
                    Builder.AppendFormat("alert('{0}');", msg);
                    Builder.AppendFormat("window.location.href='{0}'", reurl);
                    Builder.Append("</script>");
                    curPage.ClientScript.RegisterStartupScript(cstype, "信息", Builder.ToString());
                }
            }
            /// <summary>
            /// 弹出信息并后退 2007-3-23
            /// </summary>
            /// <param name="curPage">当前页面指针,一般为this</param>
            /// <param name="msg"></param>
            public static void ShowAndGoBack(System.Web.UI.Page curPage, string msg)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");
                else if (msg == null)
                    throw new ArgumentNullException("msg");
                else
                {
                    Type cstype = curPage.GetType();
                    curPage.ClientScript.RegisterStartupScript(cstype, "信息", "<script language='javascript' defer>alert('" + msg.ToString() + "');history.go(-1);</script>");
                }
            }
            /// <summary>
            /// 弹出信息并关闭 2007-3-23
            /// </summary>
            /// <param name="curPage">当前页面指针,一般为this</param>
            /// <param name="msg"></param>
            public static void ShowAndClose(System.Web.UI.Page curPage, string msg)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");
                else if (msg == null)
                    throw new ArgumentNullException("msg");
                else
                {
                    Type cstype = curPage.GetType();
                    curPage.ClientScript.RegisterStartupScript(cstype, "信息", "<script language='javascript' defer>alert('" + msg.ToString() + "');window.close();</script>");
                }
            }
            /// <summary>
            /// 直接跳转页面 2007-3-23
            /// </summary>
            /// <param name="curPage">当前页面指针,一般为this</param>
            public static void Redirect(System.Web.UI.Page curPage)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");            else
                {
                    Type cstype = curPage.GetType();
                    curPage.ClientScript.RegisterStartupScript(cstype, "信息", "<script language='javascript' defer>window.location.href='" + HttpContext.Current.Request.Url.ToString() + "';\n</script>");
                }
            }
            /// <summary>
            /// 直接跳转页面 2007-3-23
            /// </summary>
            /// <param name="curPage">当前页面指针,一般为this</param>
            /// <param name="reurl">要跳转的页面</param>
            public static void Redirect(System.Web.UI.Page curPage, string reurl)
            {
                if (curPage == null)
                    throw new ArgumentNullException("curPage");
                else if (reurl == null)
                    throw new ArgumentNullException("reurl");
                else
                {
                    Type cstype = curPage.GetType();
                    curPage.ClientScript.RegisterStartupScript(cstype, "信息", "<script language='javascript' defer>window.location.href='" + reurl + "';\n</script>");
                }
            }................后面的就不贴了,很多
      

  5.   

    用ajax + js 判断 
     
    一般都是用Label 提示的