我正在使用 .NET Core 2.1 Web 应用程序开发CookieAuthentication. 出于某种原因ExpireTimeSpan,Cookie.Expiration在CookieAuthenticationOptions对象上设置和不会对 Cookie 生存期产生影响。Chrome 始终显示相同的过期日期1969-12-31T23:59:59.000Z。所以在关闭浏览器窗口后,cookie 消失了。
启动文件
public void ConfigureServices(IServiceCollection services)
{
services.AddDistributedMemoryCache();
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.LoginPath = new PathString("/Account/Login/");
options.AccessDeniedPath = new PathString("/Account/Login/");
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
options.Cookie.Expiration = TimeSpan.FromDays(14);
options.ExpireTimeSpan = TimeSpan.FromDays(14);
});
services.AddMvc(options =>
{
options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
});
services.AddAntiforgery(options => options.HeaderName = "X-CSRF-TOKEN");
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
var …Run Code Online (Sandbox Code Playgroud) asp.net asp.net-mvc asp.net-authentication asp.net-core asp.net-core-2.0
我需要向我的 Web 请求添加一个客户端证书并尝试以这种方式实现它: Stackoverflow
在此答案的末尾,介绍了“FlurlClient 方式”。使用和配置 FlurlClient 而不是全局 FlurlHttp 配置。我试过这个,但没有用。
我创建了一个新的.NET Core控制台应用程序来向您展示问题:
static void Main(string[] args)
{
/****** NOT WORKING *******/
try
{
IFlurlClient fc1 = new FlurlClient(url)
.ConfigureClient(c => c.HttpClientFactory = new X509HttpFactory(GetCert()));
fc1.WithHeader("User-Agent", userAgent)
.WithHeader("Accept-Language", locale);
dynamic ret1 = fc1.Url.AppendPathSegments(pathSegments).GetJsonAsync()
.GetAwaiter().GetResult();
}
catch
{
// --> Exception: 403 FORBIDDEN
}
/****** NOT WORKING *******/
try
{
IFlurlClient fc2 = new FlurlClient(url);
fc2.Settings.HttpClientFactory = new X509HttpFactory(GetCert());
fc2.WithHeader("User-Agent", userAgent)
.WithHeader("Accept-Language", locale);
dynamic ret2 = fc2.Url.AppendPathSegments(pathSegments).GetJsonAsync()
.GetAwaiter().GetResult();
}
catch …Run Code Online (Sandbox Code Playgroud) 我在主屏幕和小部件库中遇到了 iOS 14 小部件的奇怪图形问题(闪烁)。安装应用更新后似乎会出现此问题。在开发过程中,我认为这是 iOS 模拟器的问题,但现在用户在我发布应用更新后报告了这个问题。
有人遇到同样的问题吗?有没有修复它或者它是Apple的错误?
这是显示问题的 2 个视频。一次在主屏幕上,一次在小部件库中。主屏幕闪烁 Widget Gallery 闪烁