NetTalk Central

Author Topic: Different Session Var between loading of page and button click  (Read 3377 times)

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Different Session Var between loading of page and button click
« on: December 09, 2014, 08:51:30 PM »
Hi Bruce/Folks,

Have got a bit of a wierd one.

There's a specific way to get a memory form on a nettalk webserver to have a different session id between loading and clicking a button.

At the moment, I have no idea how it's done.

Basically.

1. An email is sent out to contacts, at the bottom is an unsubscribe link.
2. Person clicks on unsubscribe link.
3. On loading, p_web.GetValue() retrieves the guid etc that I need.
4. Shows information to the user, and gets them to verify with a button click (yes, I could just do it on load, and tell them it's done .. This is probably what I'll end up changing to, but for the moment humor me).
5. On button click, the p_web.SessionID value is different from the value on page load.

When I test on desktop and mobile device, everything works fine.

But from the public webserver logs, I can see it happening every now and again. The session id changes between page loading and button click.

Any idea how this could happen?
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Different Session Var between loading of page and button click
« Reply #1 on: December 09, 2014, 10:22:55 PM »
Hi Stu,

I can think of 2 possible scenario's.

a) you are calling ValidateLogin at some point on the form. (And you have the setting set which changes the SessionValue on login.) This shouldn't affect you though because all the session data moves from  the old session to the new session. It would only be a factor for you if you were storing session information outside the session queue (ie in a mem table or whatever.)

b) The browser makes multiple requests, before the first request has finished being parsed. I see this a fair bit when the user goes to an "Index" page. As the page goes back to the browser it notices the links to Css and Js and starts fetching those files. But by that point it hasn't always figured out the cookies, so some requests then come back without the session cookie, an hence get a different session id.  So I guess it's possible that the page request, and button get different Session ID's.

However you'd need to confirm this (very carefully) before we start talking about solutions - at this point it's only a theory.

cheers
Bruce



Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Different Session Var between loading of page and button click
« Reply #2 on: December 09, 2014, 11:29:54 PM »
Hey Bruce,

Thanks for the speedy reply.

a. Nope. No ValidateLogin being done at all.

b. Hmmmm, maybe. In this particular problem, it occurs when a person clicks on a link sent to them in an email.

I didn't put that into the original email, because I didn't want to second guess any logic that I might be missing, but yeah.

Just noticed something.

I have code in WebHandler, ProcessLink that checks for a new session and if new logs "new session" + id etc.

Here's the order I see in the log.

1. New Session (Webhandler, ProcessLink)
2. The page gets loaded, and the p_web.GetValue() passed parameters get parsed and logged.
3. New Session (Webhandler, ProcessLink)
4. The user clicks on the button. But because of (3) it's a new session.

I'm guessing that this is the b) you are talking about.

I'm not sure HOW this happens. Maybe on a mobile device over a slow network (no wireless)?
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Different Session Var between loading of page and button click
« Reply #3 on: December 10, 2014, 03:30:29 AM »
trick would be to know which pages (ie GET's) were in those requests.

cheers
Bruce