0

I have a dotnet core 3.1 project running on a Windows 2016 server IIS. After login, a cookie is created but if the client restarts his PC the cookie still exists but application redirects to login and does not remember the user. Cookie looks like invalid.

In the same server we have also an the older version of this project build with .net framework 4.5.1 and we have never had an issue about session or cookie.

First I suppose it can from the clients browser but if it is from the client than both of the application should get the same problem.

So what else can be? What are your suggestions?

  • could you share your sample code? what is your machine key setting? it looks like some machine key configuration issue. use code:`public void ConfigureServices(IServiceCollection services){ var environment = services.BuildServiceProvider().GetRequiredService(); services.AddDataProtection() .SetApplicationName($"my-app-{environment.EnvironmentName}") .PersistKeysToFileSystem(new DirectoryInfo($@"{environment.ContentRootPath}\keys")); ... }` – Jalpa Panchal Apr 21 '20 at 03:06
  • https://stackoverflow.com/questions/46318461/asp-net-core-remember-me-persistent-cookie-not-works-after-deploy – Jalpa Panchal Apr 21 '20 at 03:06
  • Can this be an iis problem? Windows 2016 server. Both application is in same under same iis web site. (Default web site) We access them in out intranet via ip address. One of them is pointed to root 127.0.0.1 the other is in a application 127.0.0.1/V2 Can this affect the cookies? – Serhan Altug May 18 '20 at 11:12

1 Answers1

0

I found the problem. IIS's profile writing permision causes this problem. I use the aspnet_regiis.exe -ga "IIS AppPool.NET Core" to give permision.

After this command it has worked for a while but after a few days it happend again. What can it be this time?