NetTalk Central

Author Topic: Passing SessionID and AJAX  (Read 3556 times)

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Passing SessionID and AJAX
« on: May 18, 2008, 04:46:40 AM »
Hi,

Here is an interesting problem i have. I've got around the problem but someone may have faced this before and come up with something better!

In Summary: When passing the SessionID manually in the URL, all normal functionality works except AJAX. Specifically the SetServer JS function doesn't work (no errors, just doesn't work anymore).

1. Why am i passing the URL - I am integrating a desktop app with a Web App. I have build an XML Web service in NT that allows a login to be performs and a sessionid be returned in XML.

2. Subsequent calls to the web site have the SessionID added to the URL and normal stuff works. Very tidy, very happy.

3. But AJAX functionalty has stopped. Debugging showed me that the correct SessionID is not picked up by the AJAX call (SetServer fuction) therefore in any work i'm doing server side cannot see my Session varliables.

4. After some mucking around and putting a hack into the Templates I modified how the SetServer JS function was being called by adding the SessionID. It put up a struggle but i finally got the syntax such that prototype was happy and it all magically started working again.

I suspect it might be a bug... but i know i'm pushing things, so it could easily be me.

I am in NetTalk 4.30.

Regards
Bill Shields

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Re: Passing SessionID and AJAX
« Reply #1 on: May 19, 2008, 05:59:12 AM »
Hi Bill,

It's hard to say for sure - but there are a couple things being done "under the skin" that might be affecting you.

Typically when an Ajax call is made, the session ID is passed as a Cookie. So although it's not in the SetServer call, it is passed as an "implicit" parameter.

On the server side it does check the SessionId on Ajax calls - otherwise of course it can't really do anything.

You imply that the session id is getting through ok anyway - and is the correct number - but if that's the case then adding it as an extra parameter shouldn't have any effect.

I'd like to take a squiz at this app though if possible bring it down to Eden in a couple weeks' time.

Cheers
Bruce

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Passing SessionID and AJAX
« Reply #2 on: May 21, 2008, 01:26:37 AM »
Hi Bruce,

The session id was being passed as a cookie (or html header if cookies were disabled), however, it was the wrong sessionid (not the one passed on the URL).

Will bring the App to Eden (or will catch you after conference @ LJH if i don't get there).

Regards
Bill

vsorensen

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Re: Passing SessionID and AJAX
« Reply #3 on: June 14, 2008, 07:57:22 PM »
I've had a user complain that sessions were being mixed up - eg. given a User A with access to Record Set A, User B with access to Record Set B, sometimes User B would have access to User A's record set!  I've never been able to recreate the problem, unfortunately.