Home > database >  How to redirect to a customized access denied page if authorization is not met?
How to redirect to a customized access denied page if authorization is not met?

Time:12-31

I’m using Authorize(Roles = "HRManager,Finance")] on top of each razor pages to restrict user access. ( it works fine). How to redirect the faild access attempt to a customized access denied page?

I developed the access denied page. But,how to call it when a user is not authianticated?

CodePudding user response:

If you use startup ,try :

services.ConfigureApplicationCookie(opts =>
            {                   
                opts.AccessDeniedPath = "/xxx/xxx";
            });
  • Related