I am writing an ASP.NET Core 1.0 website that uses Windows authentication. I logged in and is working as expected. Currently, when authentication fails for a given user, a shared page with the "HTTP 403" error is displayed.
How do I configure ASP.NET Core to redirect to my own "access denied" page?
I tried the approach described in this article, but it didn’t work for me (perhaps because I use Windows Auth instead of Forms Auth?) How to redirect unauthorized users using ASP.NET MVC 6
Any help would be appreciated.
.
app.UseStatusCodePages(async context => { if (context.HttpContext.Response.StatusCode == 403) { // your redirect } });
app.UseStatusCodePagesWithRedirects. ( URL-), URL-. , ~/errors/403 403:
app.UseStatusCodePagesWithRedirects
~/errors/403
app.UseStatusCodePagesWithRedirects("~/errors/{0}");
Source: https://habr.com/ru/post/1648578/More articles:Effective intersection of a set to get rows in a DataFrame - dataframeРазделяет ли Numpy временные массивы в выражениях, таких как x + = 2 * y? - performanceVial check signals are not supported - pythonJava if structure structure and instruction pipelining - javaGroup in SFrame without installing graphlab - pythonfilter field from case class - scalaCol / Card Panel Centering in Materialization - htmlInstalling Dionysus OS X 10.11 - boost-pythonMany additional fields are not saved - phpThe fastest way to fetch a set of columns from large arrays in Julia - arraysAll Articles