I have a MVC5 site where I use roles like this:
[Authorize(Roles = ApplicationTypes.ReadOnlyRole)]
public partial class HomeController : BaseController
-and on missing rights, the user will see an exception + the callstack if custom-error-mode is ON and some other standard page if OFF.
How do I catch the access denied exception and redirect to another page ?? I'm aware that I could create a custom attribute and redirect from there, but this should be standard functionality and it shouldn't be necessary to come up with something custom made.
The site use windows authentication, so the user is already authenticated, but could fail later on if the roles is missing.
Thank you.