Welcome Guest, Not a member yet? Register   Sign In
Redirect inside Constructor NOT WORKING

(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.

Messages In This Thread
RE: Redirect inside Constructor NOT WORKING - by Avega Soft - 12-24-2019, 05:06 AM

Theme © iAndrew 2016 - Forum software by © MyBB