I have a simple controller like that:
[CustomFilter()]
public ActionResult Index( int? page ) {
return View();
}
public class CustomFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting( ActionExecutingContext filterContext ) {
base.OnActionExecuting( filterContext );
}
public override void OnActionExecuted( ActionExecutedContext filterContext ) {
base.OnActionExecuted( filterContext );
}
}
In main page (ASPX), if I type http://localhost/home/index?page=<script>
(is an example of XSS, I guess) instead of http://localhost/home/index?page=7
then the red page will appear (because in Visual studio I've installed AntiXSS addon).
How to create a custom filter for this type of attack and return the previous page without showing red page (with error) ? Or is not possible ?