Global.asax
how to update a database when session expires (session time out occurs) or browser is closed
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted Jul 4, 2011, 6:18 AM EDT
In the code given below, I'm updating the last visit of any registered user on my site. To do this, I'm just catching the user identity and then updating appropriate last login information in db. Find the code below:
Amit ChoudharyRank #145 · 15.8K reputationPosted Jul 4, 2011, 12:29 AM EDT
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jul 4, 2011, 12:34 AM EDT
Better to write the functionality in Global.asax file.....
nishant ranjanRank #4,961 · 317 reputationPosted Jul 4, 2011, 1:52 AM EDT
i mean how to run update command in session_end in global.asax
actually hv nt worked with global.asax
nishant ranjanRank #4,961 · 317 reputationPosted Jul 18, 2011, 3:59 AM EDT
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted Jul 18, 2011, 5:48 AM EDT
place my code in try catch block also check the login method you will be using. provided code is live on my many sites.
check by creating application variable when user login and use this instead of User.Identity.Name.
nishant ranjanRank #4,961 · 317 reputationPosted Jul 18, 2011, 10:59 PM EDT