Fixing IsLocalUrl

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-12-19 12:45:59 -08:00
parent 6493138264
commit 47c102c913

View File

@@ -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 ?? "~/");