5
Answers

session problem

ROHIT SINHA

ROHIT SINHA

7y
128
1
I have a login page and when any user login the application then there is a column called flag in the database which becomes true and logs out the application then it becomes false.The problem is that if we log in the application then we directly close the browser then flag value has to be false but it is not.
Answers (5)
2
Manav Pandya

Manav Pandya

NA 7.1k 24k 7y
Hello 
 
I have best article link for you :
 
Surely i can say it will help you somehow :
 
https://www.codeproject.com/Tips/566217/Session-killing-logout-in-server-when-browser-is-c
 
http://www.dotnetspider.com/forum/342428-end-session-or-kill-session-when-browser-closed-in-aspnet.aspx
 
Thanks
2
Dharmraj Thakur

Dharmraj Thakur

NA 4.1k 61.7k 7y
You can refer my article, It may help you which doing some work after closing tab...
 
http://www.c-sharpcorner.com/article/run-background-task-using-hostingenvironment-queuebackgroundworkitem-net-framew/ 
1
Dharmraj Thakur

Dharmraj Thakur

NA 4.1k 61.7k 7y
Hi Rohit,
 
You should implement auto logout timeout in your application like idle session expire after 1 or 2 hours and update the database flag status.
 
Or
 
You can create async service  which calls after every 5 to 10 min to check user existance, if user not exist then update your flag.
1
ROHIT SINHA

ROHIT SINHA

NA 10 325 7y
Right now I am not using session but I want to achieve it by session if you have any reference or link then please provide me 
1
Manav Pandya

Manav Pandya

NA 7.1k 24k 7y
Please provide more detail or snippet 
 
And if you are using session , than write following in PageLoad() method as :
  1. AbandonSession()  
And make flag = false ; by default  
 
Thanks