Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session clearing

Status
Not open for further replies.

tester321

Programmer
Mar 13, 2007
150
CA
Hi all, having an issue trying to lear a session via vb script function, is this at all possible? Thanks!

function clearSess()
Dim ant
ant = MsgBox("Cleared All Sessions?", vbYesNo)
If ans = vbYes Then
Session.Contents.RemoveAll()
Session.Abandon
End If
end function
 
Just a guess, but your Session object may be empty. You're not passing the object as an argument, so it'd only have a value within your function if it's a global variable. Try using this function and passing the session as an argument - myResult=clearSess(Session).

Code:
function clearSess(Session)
Dim ant
If Session Is Nothing Then
  MsgBox "There's no session to clear."
Else
  ant = MsgBox("Cleared All Sessions?", vbYesNo) 
    If ans = vbYes Then 
       Session.Contents.RemoveAll()
       Session.Abandon
    End If 
End If
end function
 
Hi Skie, there is no specific session i would like to remove or check but rather abandon all sessions. Not sure why it not working, the only thing i can think of is that the Session.Abandon procedure is not part of VBScript, i get teh message box when the function is instantiated but sessions are not abandoned, any thoughts on this? Thanks
Code:
function clearSess()
Dim ant

  ant = MsgBox("Cleared All Sessions?", vbYesNo) 

    If ans = vbYes Then Session.Abandon

end function
 
Just a though, isn't Session a server side object ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes i'm trying to clear a server side object with clientside code from onClick, thats why i asked previously if this procedure can be accomplished.

Regards
 
I'd say that the classical way is to submit a Form ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top