Is it possible to override RedirectLocal?

Topics: Customizing Orchard
Dec 14, 2011 at 4:21 PM

I need to add some smarts to this ActionResult extension.

Please let me know if you can help me.


Dec 14, 2011 at 5:04 PM

Mmmh, no, but I don't quite understand what it is you are trying to do and why.

Dec 14, 2011 at 5:35 PM
Edited Dec 14, 2011 at 5:36 PM

Oh, oh.

I'm enforcing log in for some media files, and the returnUrl is ignored.

I'm using the virtual media routes module - and the RedirectLocal does not recognize the virtual url... since it doesn't really exist.


Dec 14, 2011 at 6:03 PM

So why use RedirectLocal then if it's not doing what you want?

Dec 14, 2011 at 6:20 PM

I don't want to use it, but I'm using  HttpUnauthorizedResult to automatically produce a redirect to logon  via the accountcontroller logon action which calls return this.RedirectLocal(returnUrl);

Dec 14, 2011 at 6:55 PM

Well, then you should create your own result, that has the behavior you want.

Dec 14, 2011 at 7:07 PM

I have, I just can't figure out how to call it without touching the core account module.

Dec 14, 2011 at 8:01 PM

Well, the account controller is something you can replace, in principle. Now it may be useful to get to the bottom of why redirectlocal is not following the virtual media routes: routes in general do not "really exist" so I'm having trouble understanding what's different about those.

Dec 14, 2011 at 8:38 PM

I'd like to avoid that if possible,

redirectlocal is having a problem with the virtual route because if fails:


Dec 15, 2011 at 1:14 AM

Well, then, file a bug.

Dec 15, 2011 at 12:42 PM

Ok will do,

The problem is that throwing OrchardSecurityException uses the RawUrl unencoded for the ReturnUrl, and if the file name contains characters then IsLocalUrl fails. Razor encodes request.RawUrl ok so it's not a widespread issue.

Workaround is to rename the media files.