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

Recommended Answers

All 4 Replies

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

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?

Oh, and thanks. that helps a lot!

your welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.