This project is read-only.

Redirect AFTER Login

Topics: Customizing Orchard, Writing modules
Nov 18, 2013 at 2:12 PM
After successfully logging into Orchard, I would like to redirect the user to a specific page based on their user name and/or role membership.

Could someone point me in the right direction or better still, suggest some code that might be applicable :)

Thanks in advance for your help.

Nov 18, 2013 at 4:36 PM
Log in interaction is handled from AccountController in Orchard.Users. You can see that the default redirect happens in LogOn(string userNameOrEmail, string password, string returnUrl, bool rememberMe = false), to returnUrl.

Probably the cleanest way to do what you want is to write your own controller with such a LogOn() method, copy its body from from AccountController, add your custom logic. Then declare a route provider that points to this action an override the original route with a higher priority.