944,082 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 1772
  • ASP.NET RSS
Oct 18th, 2007
0

Help: Need to access database when session times out

Expand Post »
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
Similar Threads
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Oct 22nd, 2007
0

Re: 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
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

ASP.NET Syntax (Toggle Plain Text)
  1. Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
  2. Dim cnn as new ADODB.Connection
  3. cnn.connectionstring = "YOUR CONNECTION STRING"
  4. cnn.open
  5. cnn.execute("your SQL query")
  6. cnn.close()
  7. cnn = nothing
  8. End Sub

but why not change this value on login seeing as it is LAST '''LOGIN''' DATE
Reputation Points: 66
Solved Threads: 56
Posting Pro in Training
Fungus1487 is offline Offline
459 posts
since Apr 2007
Oct 22nd, 2007
0

Re: Help: Need to access database when session times out

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?
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Oct 22nd, 2007
0

Re: Help: Need to access database when session times out

Oh, and thanks. that helps a lot!
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Oct 24th, 2007
0

Re: Help: Need to access database when session times out

your welcome
Reputation Points: 66
Solved Threads: 56
Posting Pro in Training
Fungus1487 is offline Offline
459 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Help me in my project: web site for managing international scientific conferences
Next Thread in ASP.NET Forum Timeline: crystal reports in asp.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC