After you ask this question about authorization, I added a new custom attribute to redirect unauthorized users to a page that has more detailed information about the access request, etc. etc.
public class RedirectAuthorize:AuthorizeAttribute { protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) {
I decorated my home controller with this attribute and the correct one (Role = "..."), and it "works." Those. he refers to the method as and when expected.
I added a vanilla look to the shared views folder named Unauthorized.cshtml , but I just got the message "Could not find resource." Error 404.
Is the display URL displayed correctly?
My guess: do I need to specify a controller / action instead of a page? but Error.cshtml error handler redirect to Error.cshtml without the need for a controller?
Thanks for any help.
source share