I need this because I want to use the same App with different domains for sending mails with the domain name used by the user. Did I miss anything? Is the identifier to be converted somehow? Any idea? Thanks a lot!
In the session the Session.URL always returns the url to the session. But in stand-alone it will never return the host and/or it’s protocol so you won’t see “http://myapp.tld”
Sorry, I do not get it. The code is above, it is in the “Open” event of a page. The variable “code” should show something like “http://blabla.com:4711” … or if the user comes with another domain “http://xyzxyz.com:4711”. What do you want me to show, it’s a one-liner?
Or did I miss something? May be I misunderstood something? Thank you!
If you want to open an issue. It may only be a documentation problem.
URL for some people is the complete address including the protocol and the host, for other people, the URL could be only the relative part against the server/protocol used, so the URL can be just /index.html (for example) or what we are getting with Websession.URL
I’m intrigued about App.URL posted by Greg, should that show the host part of the URL? should that show also the protocol (http or https)? I can’t find information about that. It seems that App.URL is just an empty string.
The URL property seems to be legacy. From the old Web 1 docs:
WebApplication.URL:
The SCRIPT_NAME for the web app. For example, for a web app running on http://www.example.com/cgi-bin/example.cgi, this returns “/cgi-bin/example.cgi”. For standalone web apps this always returns the empty string.
Web 2 always run as standalone server, so this property will be always empty.
I would expect also to get the full URL, including the schema. You can achieve it with something like this:
Var baseUrl As String = If(Session.Secure, "https", "http") + "://" + Session.Header("host")
The naming should say what it actually gives, since it does not give a URL but a path, this should be changed.
For Session this is an easy fix since this knows the host and the protocol. App.URL seems to be useless unless the first call to App.HandleURL Or a session where xojo may set this.