How to control the time inside a form without taking any action

2

Good day community,

I'm doing a case management form in ASP.NET, which consists of a grid (asp: gridview) of cases that users manage, which redirects to a form, if a user is in the form of one of all cases, no other can access ... that could be controlled with a variable of application that is set when the user enters and validate it later if some other user wants to enter, but how to validate if the user in management is not doing any action or close the browser? Is there an application variable that expires every so often?

    
asked by SantiagoVictorinoC 16.09.2017 в 15:34
source

1 answer

0

Good morning,

One possible solution would be to store the information on which record the user is in a session variable. Then, in the global.asax file you define a method to clean the database in case the session ends:

void Session_End(object sender, EventArgs e)
{
    //Lógica para limpiar la sesión
    LimpiarRegistro(Session["IdRegistro"]);
}

Another thing you could do is put a timestamp on the record that is being edited to indicate when a user has entered. When you enter another user to edit it, check the time stamp and if more than X minutes have passed, you may consider that the first user has left the page.

In my opinion, this second solution would be more robust, since it avoids problems in case of a restart of the application pool or any other of this type

    
answered by 22.09.2017 в 10:23