小编Bad*_*ora的帖子

Asp.Net核心"记住我"持久性cookie在部署后不起作用

我已经构建了一个MVC Core(Framework)应用程序,我使用Identity登录.当我单击"记住我"选项时,我的开发机器上的所有内容都可以,但在服务器机器上部署之后,"记住我"在30分钟后不会保持登录状态.

我试图检查cookie到期日期是否已设置并且似乎没问题,同样在服务器机器上,cookie似乎设置得很好.您可以在下图中看到我的Cookie详细信息:

在此输入图像描述

任何人都可以帮我解决这个问题吗?

在此先感谢您的回复:)

编辑:

根据Orhun的要求,我在下面添加了我的Startup.cs内容:

public partial class Startup
{
    public SymmetricSecurityKey signingKey;

    public Startup(IHostingEnvironment env)
    {
        var builder = new ConfigurationBuilder()
            .SetBasePath(env.ContentRootPath)
            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

        if (env.IsDevelopment())
        {
            // For more details on using the user secret store see https://go.microsoft.com/fwlink/?LinkID=532709
            builder.AddUserSecrets<Startup>();
        }

        builder.AddEnvironmentVariables();
        Configuration = builder.Build();
    }

    public IConfigurationRoot Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void …
Run Code Online (Sandbox Code Playgroud)

c# cookies asp.net-core-mvc asp.net-core

11
推荐指数
1
解决办法
4713
查看次数

标签 统计

asp.net-core ×1

asp.net-core-mvc ×1

c# ×1

cookies ×1