Web Sessions

In my web app I need to leave the Xojo app to access a page on another of my sites (not Xojo) to handle some processing. I need this site to then return to the Xojo app passing in the Xojo session and another parameter (which I will have passed to the external site from Xojo as a query string). Is it possible to leave the Xojo app and then come back as I cant see how to tell Xojo that it is still in the same session. Or is their a better way to do this?

Why not use http socket to trigger scripts in background?

I need to be able to allow the user to interact with the page that is displayed and when they click on a button some stuff will happen on that systems backend and the user will be redirected back to the Xojo web app. Ideally I would just replicate what the other system is doing but due to politics I am not allowed to do that.

WebHTMLViewer is an iFrame, so you can use it to go to the other site through it and return back without quitting your app.

I tried a quick experiment by setting a ‘Go’ button on WebPage1 to go to WebPage2, which has an HTMLViewer on it filling the whole page, locked on all sides so it will keep with all screen sizes. HTMLViewer URL is set to one of my sites on a different domain. I added a button over the HTMLViewer on the lower left, locked on the bottom, which goes back to WebPage1.

When run, pressing the ‘Go’ button opens WebPage2 with the HTMLViewer filling the whole browser window so it behaves exactly as if the user had navigated to the other site, but he has a back button to return to the WebPage1 of the Xojo app without having left the session.

In terms of user experience, it should do what you describe.

Thanks, that is very close to a perfect but for what I need wont actually work, I will explain a bit more.

The Xojo app will load a page http://www.abc.com/mypage.aspx?id=1234&session=sdfdfsdf

The user will then fill in a form and a resulting page will be shown that says “Please wait…”

The resulting page will then do something like (where 8080 is the Xojo app) http://www.abc2.com:8080#returnpage?id=1234&session=sdfdfsdf

This tells my Xojo app what ID is associated with the returning information and the web session to continue to use.

Every time a user connects to a web app from some other location, a new session is generated. You may be able to store the users state in a database and then restore it when they return.

Greg, so how about the idea that the page in the HTMLviewer calls a button click event in the Xojo parent, this way the session will not have changed?

[quote=110077:@Nathan Wright]The user will then fill in a form and a resulting page will be shown that says “Please wait…”

The resulting page will then do something like (where 8080 is the Xojo app) http://www.abc2.com:8080#returnpage?id=1234&session=sdfdfsdf[/quote]

I understand. Instead of the user clicking a back button you need the other site to return to your app. Essentially to let the app know it is finished, and eventually get resulting data from it. Another way would be to do what I did in the Cunning sample for the HTML Image Map where the options triggered different HashTags that where detected through Session.HashTagChanged.

As I am writing this, I wonder if it where not possible to :

  • Have the other site call another app web service on your site through SpecialURL
  • Through IPC have this second app tell your running app the other site is finished and eventually report whatever information the other site sent as a query string
  • Go back to WebPage1

Essentially, if there is no way to get data back from the other site, have it trigger the necessary action through another app on the same server as your main app.

If you can click a button on your page through JavaScriptClick() that could do it. But the problem of getting data from the other site remains.

I have a ParentWebSession class so I can have the user open multiple pages and tie all the sessions together. I wish this was built in actually. That way you can share properties between all these same sessions. You could generate a random key in the redirect URL that brings them back and this could ensure they get tied to the same ParentWebSession. The only thing I’m unsure of is what level the ParentWebSession provides for security and session jacking for people who happen to be on the same network. I already verify IP address and a cookie.

That sounds interesting, is this something you sell, if so how much?

Thanks for the suggestions and thoughts. The JS to click the button in the Xojo app would work as I could hold the ID in a session property which the button event would then use. The problem is that my JS knowledge is not great and I am unsure how you get a child frame to “click” a button in its parent and would this cause a security alert of any sort? Maybe someone with better JS knowledge than me might have a better idea.

Nothing for sale but I’ll share what I have. I promis it’s simple.
Looks like I called the class SC_Session in one of my apps.
Create a SCSession Property on your Session class of type SC_Session
In the PrepareSession Event Add this:

//We should try and find a Session from this user already and share their SCSession if we can dim altSession as Session = app.SessionWithIdentifier(Session.Cookies.Value("session"),Session.RemoteAddress) if altSession <> nil then SCSession = altSession.SCSession else //Otherwise Create a New SCSession session.Cookies.Set("session", Session.Identifier,d) SCSession = new SC_Session SCSession.isMobile = isMobile end

You could also make it more secure by not only verifying their IP Address and the Cookie, but by also verifying their browser etc… to prevent session jacking from someone else on the network.

You can add whatever properties you want to the SC_Session class and then use them across all pages in the app.


Cheers :smiley: