(12-02-2019, 10:15 AM)kilishan Wrote: "code cleanness" can mean any number of things. For many of those definitions, Controller Filters, as previously mentioned, will keep it clean for you.
If you absolutely must do it from the constructor, you can do a slightly hacky thing and throw a RedirectException with the URL to redirect to as the message. But I highly encourage looking into controller filters, as they're specifically designed to handle the types of situations you're asking about.
Thanks a lot Lonnie for this advice/comment and this tutorial (
https://www.patreon.com/lonnieezell/posts?tag=filters) it's very helped me when catch similar problem with redirect.