我想通过使用下面的方法捕获实现IHttpHandler的potentail脚本攻击来向CustomValidator添加一条错误消息,但它似乎只是因为页面空白,任何想法而终止页面?
public override void ProcessRequest(HttpContext context)
{
try
{
base.ProcessRequest(context);
}
catch (HttpRequestValidationException ex)
{
DisplayCustomMessageInValidationSummary("< or > characters are not allowed");
}
}
private void DisplayCustomMessageInValidationSummary(string message)
{
CustomValidator CustomValidatorCtrl = new CustomValidator();
CustomValidatorCtrl.IsValid = false;
CustomValidatorCtrl.ErrorMessage = message;
this.Page.Controls.Add(CustomValidatorCtrl);
}
由于 达伦