[quote=190372:@Eric Wilson]Thanks for the reference Michael,
A browser redirect had occurred to me however I’m building a high performance app which needs to scale.
There should be nothing inherently unstable about my approach since Xojo must be able to start new instances of a session all the time. However I can’t find any docs as to the two parameters it wants or the syntax for passing them…
As an aside, it seems to me that such an approach would also address the issues in the discussion to which you referred.
Does anyone know the syntax to make my code work? Is this possible?
Thanks,
Eric[/quote]
Steve, you want to create an new instance of a WebSession that does not exist yet. When your user gets to /Special or /Whatever the app does not create a session. So you cannot have an instance of it. AFAIK the only way a session can be created (and this must be quite an undertaking) is by connecting to the “front door” of the app, so the framework does all kinds of things (looking at user IP, headers, among other things) to create the session, with an ID, that will enable displaying webpages.
When you get to the front door of the app, Session does a fulltitude of things related to the job of serving pages, then when the webpage is sent, yet another full house is necessary for it to make a grand appearance : headers, analysis of the user-agent, various kitchen sinks. SpecialURL and HandleURL are not intended for such a stage. What they do is very basic, very low level input/output intended for API and other tasks where the normal page serving would simply be a mess. To take an example, if I want to use an API as a listener for Paypal, I do not want anything to be sent to it but very precise data conformant to the specs. If I want to serve a Woff font from my app, all I want to do is when HandleURL sees the URL as being /Fonts/myFont.Woff/
it simply prints it, just the same way as it would happen if I was accessing it on a standard web space.
If what you want to do is to be able to add requests to your app, don’t use subdirectories. Use arguments and look for them in Session.URLArgument(“myargument”).
For instance, you can have users access your app as
http://127.0.0.1:8080?page=Barcelona
Then in Session, you can have this, that will display the proper page according to the argument :
Sub Open()
if URLParameter("Page") = "Barcelona" then WebPage11.Show
End Sub
I shall think that solution, much lighter, will cope much better with scaling.