954,206 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help: Need to access database when session times out

Hello, I need to access the database when a session unexpectedly ends or session times out. This is just for telling the database to update a field for when the user last logged in. The reason I need this is that it saves me tons of coding for other stuff so I do not have to use excess database ruitines, excess functions, etc.

Please if you know how to force the server to do an update on session timeouts or unexpected ends, please help.

asp.net 2.0
vb.net or lower
MySQL

SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
 

Hello, I need to access the database when a session unexpectedly ends or session times out. This is just for telling the database to update a field for when the user last logged in. The reason I need this is that it saves me tons of coding for other stuff so I do not have to use excess database ruitines, excess functions, etc.

Please if you know how to force the server to do an update on session timeouts or unexpected ends, please help.

asp.net 2.0 vb.net or lower MySQL

goto the 'CODEBEHIND' in your global.asax file located at the root. then there are events in their to handle all these occurances.

i.e. session start / end, application start / end even an event for request if the need for validation is so great.

something like

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
    Dim cnn as new ADODB.Connection
    cnn.connectionstring = "YOUR CONNECTION STRING"
    cnn.open
    cnn.execute("your SQL query")
    cnn.close()
    cnn = nothing
End Sub


but why not change this value on login seeing as it is LAST '''LOGIN''' DATE

Fungus1487
Posting Pro in Training
459 posts since Apr 2007
Reputation Points: 66
Solved Threads: 56
 

Because I will be making "new" messages appear through loging dates. An example is below:

If someone created a new marketing account, then the link will say [new]. It will only say new the first time a person logs on. So if last login date is earlier than the account was created, it will display the new symbol. After a person logs out, their lastlogin date will be updated to be LATER than the date the marketing account was created.

It's a simple and easy way to show "new" symbols without having to use files or databases. Because it is only for the admin area, it is not as important to keep track whether or not the new account was viewed.. you know what I mean?

SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
 

Oh, and thanks. that helps a lot!

SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
 

your welcome

Fungus1487
Posting Pro in Training
459 posts since Apr 2007
Reputation Points: 66
Solved Threads: 56
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You