Problem with Global.asa.... HELP!!

Results 1 to 2 of 2

Thread: Problem with Global.asa.... HELP!!

  1. #1
    Join Date
    Dec 1969

    Default Problem with Global.asa.... HELP!!

    Well im having problems with the global.asa file, what i want to do is that when a person entres to my site, and it has a specific cookie, the Sub Session_OnStart insert the cookie value into a database (This is working), and the second thing is that when the visitor&#039;s session time&#039;s out because of timeout or just because he leaves my site, the Sub Session_OnEnd delete his name of the database(this isn&#039;t working!)<BR>Here&#039;s the code:<BR><BR>************************************* ***********<BR>&#060;SCRIPT LANGUAGE="VBScript" RUNAT="Server"&#062;<BR>Sub Application_OnStart<BR>End Sub<BR><BR>Sub Session_OnStart &#039;This is now working!<BR> Session.Timeout = 20<BR> Session("Start") = Now<BR> Application.Lock<BR> dim usuario<BR> usuario = Request.cookies("user")("name")<BR> if (user &#060;&#062; "") then<BR> set user = Server.CreateObject("ADODB.Command")<BR> user.ActiveConnection = (dsn=xxx;uid=xxx;pwd=xxx;")<BR> user.CommandText = "insert into users (user) values (&#039;" & user & "&#039;)" <BR> user.Execute<BR> usuer.ActiveConnection.Close<BR> end if<BR>End Sub<BR><BR>Sub Session_OnEnd &#039;This is the not working part!<BR> dim user<BR> user = Request.cookies("user")("name")<BR> if (user &#060;&#062; "") then<BR> set erase = Server.CreateObject("ADODB.Command")<BR> erase.ActiveConnection = ("dsn=xxx;uid=xxx;pwd=xxx;")<BR> erase.CommandText = "delete from users Where user = &#039;" & user & "&#039;)" <BR> erase.Execute<BR> erase.ActiveConnection.Close<BR> end if<BR>End Sub<BR>&#060;/SCRIPT&#062;<BR>********************************** ************<BR><BR>Please help me with this!<BR>Greetings from Costa Rica!

  2. #2
    Join Date
    Dec 1969

    Default Session_OnEnd is NOT RELIABLE

    try not to rely on it. you&#039;d need to schedule a sweep of the DB occassionally to wipe out old entries instead.<BR><BR>why are you storing session data in a DB anyway, though?<BR><BR>j<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts