Base solution for your next web application
Open Closed

How to set Session expire time #4536


User avatar
0
zepan created

How to set Session expire time.If the user does not have any action for 2 hours, the user will exit the login status.Thanks.


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you are using ASP.NET Core, then it is something like this:

    services.AddSession(options => { 
        options.IdleTimeout = TimeSpan.FromMinutes(1); 
     });
    

    If it is MVC 5.x, then <a class="postlink" href="https://stackoverflow.com/questions/22365836/mvc-5-session-timeout-after-default-period-20-mins">https://stackoverflow.com/questions/223 ... od-20-mins</a>.

  • User Avatar
    0
    zepan created

    Sorry,I use .net Framew 4.6.1.Thanks.

  • User Avatar
    0
    aaron created
    Support Team

    .NET Framework 4.6.1 on ASP.NET Core or MVC 5.x?

    Answers were given for both.