Within my ASP.NET App I am using a Method to check user permissions to decide whether the user can view the page, or get redirected to the “Invalid Permissions” page.
Since adding this Permission Redirect on the Master Page would cause an infinite loop, I am forced to apply it to all pages. I do not want to have to copy this Method onto every page, so I would like to create a class within my Web App which holds this Method so I can use it globally across my app.
I have had no formal training, but my gut is telling me that it’s bad practice to place a Response.Redirect or any “Web” functions in a class? Am I correct? And if so, is there a better way to go about this?
You can check the current url to make sure that it is not already the invalid permissions page before redirecting; therefore, you will only redirect when you are not already there.