Button在updatepanel中,Page_Error的问题
qikaa 2011-08-28 04:08:21 protected void Page_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>alert('字符非法!');location.href='login.aspx';</script>", false);
Server.ClearError();
}
}
private void InitializeComponent()
{
//重绘窗体选择控件结束
this.Error += new EventHandler(Page_Error);
this.Load += new System.EventHandler(this.Page_Load);
//重绘窗体选择控件结束
}
但是出现错误还是不能得到服务器的错误提示信息。