简体   繁体   中英

Asp .Net Core Identity automatically logout after some minutes

In one of my project, I used Microsoft identity for authorization and authentication. The problem is user automatically log out after some minutes of inactivity. This is my current setting:

builder.Services.ConfigureApplicationCookie(options =>
{
    
    options.AccessDeniedPath = "/503";
    options.ExpireTimeSpan = TimeSpan.FromDays(30);
    options.LoginPath = "/Index";
    
    
});

builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme);

The application works fine in the development environment or in local IIS. However, this problem exist when I publish my application to the host provider. I wonder if there is anyway to solve this problem or if I missing some configurations.

I could be wrong, but in our project we use a tag in Web.config to set expiration time of a session:

<configuration>
  <system.web>
    <sessionState mode="InProc" timeout="4800"/>
  </system.web>
</configuration>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM