I can not make a Redirect towards an external url

0

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

    
asked by vcasas 26.06.2018 в 15:09
source

1 answer

1

You only have to specify the complete URL, since it is not found in your application.

if (isBloqueado)
{
   return Redirect("http://www.google.cl");
}
    
answered by 26.06.2018 в 15:48