I am creating an action filter to validate certain data in which, if followed, it follows the normal flow of the application, but otherwise it must be redirected to an external url.
So far I have been doing tests and nothing has worked for me to redirect to an external url, the current code I have is this:
public class ValidateActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
bool isBloqueado = true;
if (isBloqueado)
{
filterContext.HttpContext.Response.Redirect("www.google.cl", true);
return;
}
base.OnActionExecuting(filterContext);
}
}
Can someone help me see what I'm doing wrong? since when it passes through the redirect
it returns an error 404
because it is like this the url