Skip to content

Clear all session from web #1014

Closed
Closed

Description

@itg-assistant

Truong Nguyen asked 2017-08-15 07:51:38 UTC

I am implementing the user logout function. However, I can not find the best way to clear all session froms application.

We have Session.Clear(), Session.RemoveAll() and Session.Abandon() to remove all sessions from Asp.Net web.

In the Wisej, How can I do that?

Thank you.

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-08-15 15:52:19 UTC

    Session.Clear or Abandon or RemoveAll don't clear all sessions. It only clears all values stored in the single current session.

    In Wisej if you want to terminate a session or an application use Application.Exit(). If you stored something in the session object use Application.Session.Clear(). The Application.Session object is a dynamic object in Wisej but it also implements the IDictionary interface.

    To close all open windows iterate the Application.OpenForms collection. However when you call Form.Close if your code handles FormClosing and cancels the form will not close. You can force it calling Close(CloseReason.ApplicationExit) but it's an internal method, you'd have to call it using reflection. We can make it public if needed.

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Truong Nguyen answered 2017-08-15 16:02:24 UTC

    I just need to clear all session values. Can Application.Session.Clear() dymanic method help it?

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Jorge Bastos answered 2019-05-12 21:45:57 UTC

    Hi,

    Application.exit() does the job, but how can I do to to again to the login page after it?

    Thanks in advanced,

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Levie (ITG) answered 2019-05-12 21:52:44 UTC

    Hi Jorge, you should use the method described by Luca below: iterate through Application.OpenForms and close them all. After closing all of them, Re-open the Login form (dim frm = new LoginForm(), frm.Show(),). You could also just not close the original login form but could hide it instead. So, you would iterate through Application.OpenForms closing each one, except if the form is the hidden login window (unhide /show it). Then go on to clear your session variables with Application.Session.Clear(). Does this make sense? -Levie

  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Jorge Bastos answered 2019-05-12 22:15:17 UTC

    Found it!

    “autoReload”: true,

    in Default.json

  6. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Jorge Bastos answered 2019-05-12 22:19:02 UTC

    Thanks Levie,
    I’ve done it with the autoReload: True in default.json, works great,
    It’s also a way of doing it right?

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

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions