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

"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.
Reply


Messages In This Thread
RE: Redirect inside Constructor NOT WORKING - by kilishan - 12-02-2019, 10:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB