This Global.asa does NOTHING

Results 1 to 2 of 2

Thread: This Global.asa does NOTHING

  1. #1
    Join Date
    Dec 1969

    Default This Global.asa does NOTHING

    I need this global.asa file to clear the users shopping cart record and if possible redirect the user to default.htm. However none of the anticipated functionality has been achieved. Any thoughts on why?<BR><BR>&#060;SCRIPT LANGUAGE=&#039VBScript&#039 RUNAT=&#039Server&#039&#062;<BR><BR>Sub Session_OnEnd<BR> ClearCart(Session("Cart_ID"))<BR> Response.Redirect "default.asp"<BR>End Sub<BR><BR>Sub ClearCart(Cart_ID)<BR> Dim DB <BR> Dim rsCart<BR> Dim rsCustomer<BR><BR> Set DB = Server.CreateObject("ADODB.Connection")<BR> DB.Open("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=d:inetpubftprootcart.mdb")<BR> <BR> Set rsCart = Server.CreateObject("ADODB.Recordset")<BR> strSQL = "Select * FROM Carts WHERE Cart_ID=" & CART_ID<BR> rsCart.Open strSQL, DB,1,2<BR> If rsCart("CheckoutCompleted") = False then<BR> rsCart.Delete<BR> rsCart.Update <BR> End If<BR> rsCart.Close<BR> rsCart = nothing<BR> DB.Close<BR> DB = nothing<BR><BR>End Sub<BR>&#060;/SCRIPT&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: This Global.asa does NOTHING

    (1) Session_onEnd will only be triggered after the 20 minute time out. Are you waiting for it?<BR><BR>(2) You *certainly* can&#039t redirect the user! After all, he/she may have left your site completely 19 minutes and 59 seconds ago!<BR><BR>(3) I think you are doing the removal of the unprocessed cart backwards. What you should do is keep all cart info in a "temporary" table. When you user actually completes the "buy", then and there you remove that particular cart info from the temporary table. And, perhaps, set a session variable to indicate you have done this. In Session_onEnd, then, you simply do an unconditional <BR>&nbsp;&nbsp;&nbsp;&nbsp;DB.Execute("DELETE FROM tempCartTable WHERE CartID=" & cartid)<BR><BR>You can even ignore any error that might give you, in case somehow you had already deleted it but thought you hadn&#039t.<BR><BR>No?<BR><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