I am passing the returnUrl = Request.Url
to a controller action, the problem is that when I check it with the following code before redirecting, it fails because of the IsLocalUrl()
call. Why?
if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
&& !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
{
return Redirect(returnUrl);
}
Thanks.