jgrowl 消息不受欢迎地显示
try{
myConnection.Open();
SqlCommand myCommd = new SqlCommand(StrMemberId, myConnection);
myCommd.Parameters.AddWithValue("@MemberId", TxtEnterMemberId.Text);
int value=(int)myCommd.ExecuteScalar();
if (value!= 0 )
{
Response.Redirect("GeneralExamination.aspx? MemberId=" + this.TxtEnterMemberId);
}
else
{
string js = "$.jGrowl(' Invalid Member Id Try Again ');";
Page.ClientScript.RegisterStartupScript(typeof(string), "jgrowlwarn", js, true);
TxtEnterMemberId.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally {
myConnection.Close();
}
}
我在这里尝试做的是搜索成员,如果不存在或无效输入 jgrowl 将显示一条消息(工作正常)。 i.) 现在的问题是,当我给出正确的 memberId 时,会生成一条消息,提示“线程正在中止”。但它确实被重定向到目标页面。异常是什么?
ii.) 当我转到下一页并单击后退按钮时。消息框显示“要显示此页面,Firefox 必须发送将重复之前执行的任何操作(例如搜索或订单确认)的信息。 ”如果我单击重新发送,则会再次显示咆哮声。该怎么处理呢?
请帮助解决问题..
try{
myConnection.Open();
SqlCommand myCommd = new SqlCommand(StrMemberId, myConnection);
myCommd.Parameters.AddWithValue("@MemberId", TxtEnterMemberId.Text);
int value=(int)myCommd.ExecuteScalar();
if (value!= 0 )
{
Response.Redirect("GeneralExamination.aspx? MemberId=" + this.TxtEnterMemberId);
}
else
{
string js = "$.jGrowl(' Invalid Member Id Try Again ');";
Page.ClientScript.RegisterStartupScript(typeof(string), "jgrowlwarn", js, true);
TxtEnterMemberId.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally {
myConnection.Close();
}
}
What I am trying to do here is search a Member if does not exist or invalid input jgrowl will show a message(works fine).
i.) Now the problem is when i give the correct memberId a message is generated saying "thread was being aborted." but it does gets redirected to the destined page.What isthe exception about?
ii.) When i go to the next page and click on the back button.A msg box says"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier." if i click resend the growl is displayed again. How to deal with that?
Please help to overcome the problems..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
I)我认为异常是在 try/catch 块内创建 Response.Redirect ,为了避免异常,您可以向 Redirect 添加一个 false 参数。
详细信息: 如果使用 Response.End、Response,则会发生 ThreadAbortException。重定向或 Server.Transfer
I) I think that the exception is for making a Response.Redirect inside a try/catch block, to avoid the exception you could add a false parameter to Redirect.
more info: ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer