SessionId Property exists or not

S

Soha El-Saeed

Dear All;
I want to ask about how could I know if a specific sessionid still
exists or not. If there is a method or anything that can tell me about
the existence of a specific sessionid .
Thank You
Soha El-Saeed
 
R

Ray at

What is your goal here? Just knowing a session number will not do anything
unless you're tying the session to some other specific piece of information
you're after, in which case, you can use SEssion_OnEnd to do what you're
looking to do with that data, I'd imagine.
 
S

Soha El-Saeed

I want to know that a sessionid exists or not because I have created
(on the server) for each user a txt file which has the sessionid as
its name. After the session is ended I have to delete the file , but
of course I can't use the session_onend event because I can't use
server.mappath. That's why I need to know if a sessionid exists or not
so I can delete the corresponding file.
Thank You for your reply.
Soha El-Saeed
 
S

Soha El-Saeed

I can't use any session variables , properties or methods in the
session_onend event. So the only way is to know if a sessionid still
exists or not to delete the file without using the session_onend
event.
Thank You
Soha El-Saeed
 
R

Ray at

Why not?

<script language=vbscript runat=server>
sub session_onStart()
Session("filePath") = Server.MapPath("/") & "\" & Session.SessionID &
".txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.CreateTextFile(Session("filePath"), True)
oFile.Write "hey"
oFile.Close : Set oFile = Nothing
Set oFSO = Nothing
End Sub

Sub Session_onEnd()
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.DeleteFile Session("filePath")
Set oFSO = Nothing
End Sub
</script>


I don't know that I personally would want to do this, but this should work,
in theory.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,825
Members
47,371
Latest member
Brkaa

Latest Threads

Top