How to set Path for ASP.NET Core Identity cookie

后端 未结 1 909
礼貌的吻别
礼貌的吻别 2021-01-27 00:51

I have an ASP.NET Core MVC application that also hosts an API. The site uses Identity defaults so when you log in a cookie is set. The API has been configured to use JWT Beare

1条回答
  •  遥遥无期
    2021-01-27 01:15

    You should be able to configure the cookie path in ConfigureServices like:

      services.ConfigureApplicationCookie(options =>
      {
        options.Cookie.Path = "/";
      });
    

    See https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-configuration?view=aspnetcore-2.1&tabs=aspnetcore2x#cookie-settings

    0 讨论(0)
提交回复
热议问题