捕获FormRequest安全错误的类

protected void Page_Error(object sender, EventArgs e)
    {
        Exception ex = Server.GetLastError();
        if (HttpContext.Current.Server.GetLastError() is HttpRequestValidationException)
        {
            HttpContext.Current.Response.Write("请输入合法的字符串【<a href=\"javascript:history.back(0);\">返回</a>】");
            HttpContext.Current.Server.ClearError();
        }
    }
posted @ 2010-11-26 11:09  tian_z  阅读(389)  评论(0编辑  收藏  举报