Trapping HttpRequestValidationException

Protected Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error
If Server.GetLastError.GetType Is GetType(System.Web.HttpRequestValidationException) Then
Server.ClearError()
Response.Redirect("ErrorTrap.aspx?Err=Naughty chars entered!")
'Response.Write("You entered inappropriate characters.<br>")
'Response.Write("Start Over or click Back.")
End If
End Sub

Post a comment

Comments closed