大家都说说,自己是怎么处理错误信息的,就是比如密码输入错误,怎么提示?标题是空的怎么提示?等等.. 汗....我的意思是说,大致怎么实现的?比如是转到一个提示错误的页,还是alert()之类的... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 个人感觉最好就是放个Label用于显示错误消息,不要弹来弹去的,省得浏览器提意见。 response.write("<script>alert('用户或密码错误');location.href='页面名称';</script>") 或使用Label都可以。登陆页面一般的数据都不应该很大吧 我是放在类库中进行处理的:/// <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>"); } }................后面的就不贴了,很多 用ajax + js 判断 一般都是用Label 提示的 JS中的参数 asp.net结合extjs 3.0 对于HttpProxy参数url格式问题 关于gridview绑定数据的问题,高手帮忙解决一下 如果实现对Tags Cloud搜索? 求助:Asp和asp.net项目的集成和数据传递 在VB里发帖没有一个人回,气,都是什么高手???看这里的哥们是不是厚道些…… treeview和xml动态添加和删除节点 大家来帮我解决个小问题! ASP.NET 如何、申请一个站点 讨个方法,想把dataset中的数据存到 access 或一个文件中,然后再取出来,用什么方法简单 App_Code文件夹的问题
使用Label都可以。登陆页面一般的数据都不应该很大吧
/// <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>");
}
}................后面的就不贴了,很多
一般都是用Label 提示的