Help: Need to access database when session times out

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Help: Need to access database when session times out

 
0
  #1
Oct 18th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

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

 
0
  #2
Oct 22nd, 2007
Originally Posted by SheSaidImaPregy View 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
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

  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
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

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

 
0
  #3
Oct 22nd, 2007
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?
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

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

 
0
  #4
Oct 22nd, 2007
Oh, and thanks. that helps a lot!
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

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

 
0
  #5
Oct 24th, 2007
your welcome
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC