我正在使用带有cookie身份验证的.NET核心2.0.
我的配置如下所示:
services
.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(1);
options.SlidingExpiration = true;
options.Cookie.Name = "authtoken";
});
Run Code Online (Sandbox Code Playgroud)
当我访问未经授权的控制器时,我被重定向到 /Account/Login
在.NET Core 1.1中,我可以通过设置来配置它
AutomaticChallenge = false.
如何在.NET Core 2.0中配置它?
我只是希望我的控制器返回HTTP 403.
我在 PostgreSQL 中有下表,需要获取具有给定 ID 的人的所有祖先。
还需要能够从结果中区分父亲和母亲。
Person table - has about 1M rows, schema looks like this:
+-----+--------+--------+
| id | father | mother |
+-----+--------+--------+
| 1 | 2 | 3 |
| 2 | 4 | 5 |
| 3 | 6 | 7 |
| 4 | 8 | 9 |
| 5 | 10 | 11 |
| ... | ... | ... |
| ... | ... | ... |
+-----+--------+--------+
Run Code Online (Sandbox Code Playgroud)
目前我正在循环进行查询,每个人获得单行。
是否可以在单个查询(或 2 个查询)中获取所有祖先? …