Problem With Session?

Sorry to post so much but I got questions and this is my only avenue for answers… So I have my web app. There is a registration database. When user logs in, it verifies the registration database and grabs registration information. Then it creates a session database so i can pass the information between multiple web apps.

So I log into my app from my desktop computer and it works fine, validates me and creates this session database. I go to my iPad and try to log in as a second user but it already has my first account logged in even though I just started the app from my iPad. This should be a second instance of this app running and I should not automatically be logged in as if I was on my computer. In the app there is nothing telling it to automatically log in. Logins happen only when I go to the login window and type in my information. I don’t understand why my iPad is automatically logging in or acting like I already went through the login process. . Is there a problem with the session? Because its from the same IP address is it jumping into the same session? I don’t understand… Any ideas?

Are you working with cookies in your login method???
Are you setting a flag that a user is logged-in that your loginform looks at???

debug your login screen…

Because what you are describing is something we (xojo community) always wanted but is not possible… Resuming a session (F5) …
Every connection has it’s own session and you can’t attach one session to a other socket…

So my shot is option 2 (cookies you had checked first before post on this forum).

[quote=480189:@Erwin Meijer]Are you working with cookies in your login method???
Are you setting a flag that a user is logged-in that your loginform looks at???

debug your login screen…

Because what you are describing is something we (xojo community) always wanted but is not possible… Resuming a session (F5) …
Every connection has it’s own session and you can’t attach one session to a other socket…

So my shot is option 2 (cookies you had checked first before post on this forum).[/quote]

I first suspected that it was a problem I caused. Initially had a method that used a saved cookie to auto log back in. I stripped out all of the cookies. I removed my auto login method. No matter what I do, when I log into my desktop and then go to log in my iPad it’s already logged in. I created another fake account on my iPad. Logged in from my iPad. Then loaded a fresh page on my desktop. Cleared cookies in chromes settings. On the desktop I went to log in and it has my new fake account already logged in without me going through the login process. It’s weird. It’s like it’s jumping into the same session.

Pretty sure that it’s like the jumping to the same session :slight_smile: … But they are not… :wink:

To convince you, you can add :

system.DebugLog(Session.Identifier)

Add this code to you session prepare event to see if they have the same number (they won’t)
What I do for debugging is add a array of websessions in app add on preparesession event your session to the array and see what’s happening…


Open a new webproject and move your login form step by step to it … that’s the hardway but the best way to go :frowning:

Just to be clear… each user does not get a separate instance of the app. All users exist together in the same app instance as separate Sessions.

As you mentioned in the other thread you’re trying to setup a system whereby discrete web apps can pass the same user login session between them. To be clear, your ‘user session’…whatever that entails (cookies, URL parameters, records in a database)…is distinct from a specific Xojo WebSession instance. It’s your code which identifies an active user session and associates it with a new WebSession instance.

My guess is that somewhere your code is looking at data which is global in scope, seeing the first logged in user, and assigning that user to the new Session. So basically what Greg is pointing out.

Sounds like you are referring to some kind of a home grow session rather than the XOJO web session…

Can you post some code about how you create this session and code on how you conclude you are already logged in.

So when I login the user and I change the caption of a toolbar button’s caption so that it says the user name instead of ‘login’ your saying that every user will see that caption until some other user changes it in their session? Whatever changes I make in the app such as caption on a button, all users can see it since its not a separate instance of the app?

No.
your caption should be (I don’t know your code) based on session so every user will see his user name.
Istance= application
Session = the user “space” within the application
Page (or component within the page)= user data that should be based on session (and if based on app only for shared, common or other rare case data)

[quote=480211:@Antonio Rinaldi]No.
your caption should be (I don’t know your code) based on session so every user will see his user name.
Istance= application
Session = the user “space” within the application
Page (or component within the page)= user data that should be based on session (and if based on app only for shared, common or other rare case data)[/quote]

But I’m using a global string to set the caption so this is why it appears to everyone? I should be storing it in a session property?

If you are using a global property you should not be surprised that every user will see it!

yes, use a session property.

[quote=480214:@Antonio Rinaldi]If you are using a global property you should not be surprised that every user will see it!

yes, use a session property.[/quote]

So it’s not actually logging in, when I login on one device and set my global on that device and then the caption, it is just the caption changing and not a full login happening? Ok this makes since. Thank you and everyone so much for helping me understand.