Trying to understand the sessions.

I would like to allow only one access per user in my webapp; but the code i wrote i’snt working; every time return ‘user alredy conected’; but he is not.

For i As Integer = 0 To App.SessionCount - 1 If App.SessionAtIndex(i).Identifier <> Session.Identifier Then If Session.MyUserName=App.SessionAtIndex(i).MyUserName Then MsgBox "User Alredy Connected." App.SessionAtIndex(i).ShowURL(App.URL) End End If Next

Could you help me?

Where did you put this code?

Inside Action of a button in my login form.

The problem probably has to do with the fact that sessions persist for a little time after the user navigates away from the app. If you truly want only one login per user, you might instead try closing the previous session instead of disallowing the new one. In your loop, instead of the msgbox and showurl, just put app.sessionatindex(I).close.