Fixing IsLocalUrl

--HG--
extra : rebase_source : 645fac775f5fe3fa8c4e9db1df1824cc524cf39b
This commit is contained in:
Sebastien Ros
2011-12-19 12:45:59 -08:00
parent cad1149ea5
commit f9aa92751b
@@ -15,7 +15,12 @@ namespace Orchard.Mvc.Extensions {
}
public static ActionResult RedirectLocal(this Controller controller, string redirectUrl, string defaultUrl) {
if (!string.IsNullOrWhiteSpace(redirectUrl) && controller.Url.IsLocalUrl(redirectUrl)) {
if (!string.IsNullOrWhiteSpace(redirectUrl)
&& controller.Url.IsLocalUrl(redirectUrl)
&& redirectUrl.StartsWith("/")
&& !redirectUrl.StartsWith("//")
&& !redirectUrl.StartsWith("/\\")) {
return new RedirectResult(redirectUrl);
}
return new RedirectResult(defaultUrl ?? "~/");