How can I redirect to another external page?

0

I have an Action Filter that validates if something exists and executes a redirect to redirect to a page x.

public class CustomFilterAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        string miString = algo; // puede venir null o no
        if (string.IsNullOrEmpty(miString)
            filterContext.Result = new RedirectResult("www.google.cl");
            return;

        base.OnActionExecuting(filterContext);
    }
}

But the redirect does not work, I was debugging and if it enters if but it just does not do what it should do. Does anyone know how to achieve this? or else I'm failing.

    
asked by vcasas 25.06.2018 в 22:42
source

1 answer

1

Brother tries like this:

return Content("<script>window.location = 'example.com';</script>"); 

or

Redirect("www.google.com");
    
answered by 25.06.2018 в 23:57