V
V
vAIB1YwO4yJxj392019-02-08 16:02:03
ASP.NET
vAIB1YwO4yJxj39, 2019-02-08 16:02:03

How to close the Open Redirect vulnerability?

How to close the Open Redirect vulnerability on a website written with ASP.NET?
Is it possible to create a list with "white" redirect addresses? If so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-02-09
@yarosroman

private ActionResult RedirectToLocal(string returnUrl)
{
    if (Url.IsLocalUrl(returnUrl))
    {
        return Redirect(returnUrl);
    }
    else
    {
        return RedirectToAction("Index", "Home");
    }
}

In Asp.net core we use LocalRedirect.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question