How to solve this session problem in ASP.NET, VB.NET?

How to solve this session problem in ASP.NET, VB.NET?

The following requirement:

When an authorized user logs in to the system so that the user is not allowed to enter the system from another computer or in a different browser, besides this user, he is currently being used correctly.

We applied the following: We saved "Is_Loggedin" as a column with the data type "bit" in mst_vendor as the table name. When a user logs in, we set the Is_Loggedin flag to "1", and every time someone tries to log in using this account, the system displays a "User already registered" error.

When the user logs out, he switches to "0" as the logout procedure is called as soon as the user clicks the logout button.

Problem Scenario:

  • When the user closes the browser, the flag remains unchanged, that is, "1".

  • When the power turns off, it remains the same as "1".

  • If the session timeouts after the predefined value remain unchanged.

  • There may be different scenarios.

Is there a way to save this internal flag for user login status using an application object?

This can improve system performance as well as eliminate the above problem scenarios.

+3
source share
5 answers

Global.asax Session_End.

Session_End: , , - .

+4

- , .

, - "1", , , , . .

+2

script, , , .

, , , , .

0

, a script . 5 20, session.end global.asax, .

0

,

  • SlidingExpiration.

  • , , . , , .

  • , . ( , , , .)

  • Application_PreRequestHandlerExecute , ( ), reset . , reset.

  • , .

  • , , .

  • , , .

- " " .

, / , .

0

Source: https://habr.com/ru/post/1777640/


All Articles