Skip to content

Session is still active after user closes the browser tab - auto logs in again #1237

Closed

Description

@itg-assistant

edmond girardi asked 2017-12-02 22:32:48 UTC

Doing some testing - it looks like if you login, use the app, close the browser tab.

Then, open a new tab and go to the site's URL - it automatically brings up the app and bypasses the login page.

I can see this as being an issue on a  machine that is shared by multiple users. Or, even worse - when an unauthorized user navigates to the site on a machine where the previous user just closed the tab page.

Is there any way to at least have the login page come back up ? I don't mind the session hanging around for a while, that's a good thing if they lost connection i guess.

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-12-02 22:54:26 UTC

    Session cookies are deleted when the browser is closed. Closing a tab is the same hitting refresh for the browser. There is no type of cookie that is removed when closing a browser tab. This same behavior is present with ASP.NET/MVC when using the ASP.NET session.

    With Wisej you can change it in two ways:

    • Clear the session cookie when the tab is closed by adding:
    <script> window.onunload = function () { document.cookie = "Wisej.SessionId=;"; } </script>

    The downside is that a simple refresh will also delete the cookie and create a new session.  Adding an argument to the URL will also be perceived by the brower as a tab being closed so the session will be lost as well with the code above.

    • Add "cookieless":true to Default.json.

    Wisej will add the session id to the URL and ignore the cookie. A refresh will preserve the session. Closing the tab will lose it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn improvement to something that already works.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions