Search code examples
asp.net-mvciis-8

Getting a 403 Error After Session Timeout, Now Unable to Login or Logout


I have a website that requires a lot of data entry. It hasn't been an issue until recently. Now the user is getting a 403 error, which I assume is caused by the session timeout. The problem I am having is that now, every page gives you a 403 error, even the logout. So, until I clear all the site cookies, the user is unable to do anything. I have to believe there is a better way to resolve this without having to resort to clearing cookies. Thanks.

Wade


Solution

  • There are so many reasons behind the session timeout:

    1)Application Pool is recycled

    2)IIS/worker process is restarted

    3)Application Domain is restarted.

    4)Some times system admins(IIS server admins) restricted the applications due to heavy burden of database log files please check the database log files

    First, check the iis log for the sub status code.try to set the session time and application pool recycle time the same value. iis ideal time out default value is 20 minutes.

    you could also set the iis HTTP keep-alive setting by following below steps:

    enter image description here

    https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httpprotocol/

    you can use the Auto-Start behavior to keep the app "Always Running".

    https://weblogs.asp.net/scottgu/auto-start-asp-net-applications-vs-2010-and-net-4-0-series