ASP.NET Core 2.0 disable automatic challenge

前端 未结 8 885
萌比男神i
萌比男神i 2020-11-28 13:40

After upgrading my ASP.NET Core project to 2.0, attempts to access protected endpoints no longer returns 401, but redirects to an (non-existing) endpoint in an attempt to le

8条回答
  •  清酒与你
    2020-11-28 13:52

    I'm not sure how to generate the 401 error, however if you use the:

    o.AccessDeniedPath = "{path to invalid}";
    

    This will allow you to redirect somewhere when the challenge has failed.

提交回复
热议问题