F
Fredrik Rodin
Hi!
I want to basicaööy run a Session.Abandon() on logout but keep one session.
In order to do this I'm iterating through my session collection by runing
the follwoing code:
Dim iSessionCount As Integer = Session.Count - 1
For i As Integer = 0 To iSessionCount
If Session.Contents.Keys(i) <> "ReturnPath" Then
Session.Remove(Session.Keys(i))
End If
Next
The statement works fine, but since I use the remove-statement, the index
decrease by 1 for each session I remove. So, let's say I have 5 sessions. i
run my code and iSessionCount will be 4 all through the loop. BUT, after the
first removal, the session index count will be 3. As a result of this I will
end up in an out-of-index error message.
Any ideas? I've been googling around but can only find solutions for the
Classic ASP-world and I want to do it the .NET-way.
Any help is appreciated.
Thanks in advacne,
Fred
I want to basicaööy run a Session.Abandon() on logout but keep one session.
In order to do this I'm iterating through my session collection by runing
the follwoing code:
Dim iSessionCount As Integer = Session.Count - 1
For i As Integer = 0 To iSessionCount
If Session.Contents.Keys(i) <> "ReturnPath" Then
Session.Remove(Session.Keys(i))
End If
Next
The statement works fine, but since I use the remove-statement, the index
decrease by 1 for each session I remove. So, let's say I have 5 sessions. i
run my code and iSessionCount will be 4 all through the loop. BUT, after the
first removal, the session index count will be 3. As a result of this I will
end up in an out-of-index error message.
Any ideas? I've been googling around but can only find solutions for the
Classic ASP-world and I want to do it the .NET-way.
Any help is appreciated.
Thanks in advacne,
Fred