[quote=159703:@James Nicholson-Plank]I get an Internal Server Error when I try to access a xojo webPage in the handleUrl method.
I was wondering if there is a way around this. i.e. is it actually possible to access xojo pages here or am I miss using handleUrl. i.e. it is not designed to allow this.
to give some context…
Ive created an app to serve up a product display in an iframe in a website through my webPage “productViewPage”
The startup page goes to my maintenance screen and is designed NOT to use in an iframe. i.e. its accessed the normal way.
I was hoping to use handleUrl and add a url snippet to the end on my site string in the iframe to redirect the iframe to the correct page
so I tried
If Request.Path <> "" then
Request.Status = 200 /
which creates the below error when it gets the show statement
Internal Server Error
The server encountered an unhandled NilObjectException while executing this request.
Can I actually achieve my objective in the method ?
or am I barking up the wrong tree and this is not how handleUrl can be used.
Thanks for your thoughts…[/quote]
WebPage.Show cannot be used within an app event, since a webpage has to be part of session to display.
Worse, ShowURL cannot be used either there. Although I do not really see why. Maybe we should put that as a feature request, unless there is some technical impossibility. Greg, are you around ? Is ShowURL in HandleURL a possibility ?
In the meantime, I needed precisely that feature, so I used a workaround (smile).
[code]Function HandleURL(Request As WebRequest) As Boolean
If request.Path = “” then return false
Request.Print “<META HTTP-EQUIV=”“REFRESH”" CONTENT="“0;URL=http://www.fontmenu.com/index.html”">"
This in HandleURL will take the user to my site fontmenu.com.
If you want to take him to one of the pages in your app, you got to take the user to your app, and use the query string to display the proper page.
In the Session Open event, put this, and the app will open directly on the page
if me.URLParameter("page") = "productViewPage" then
I have used the debug URL, but of course this works fine as well with cgi or standalone on a host. If you want to test that on debug, run the project, and open the url in a new tab, otherwise the session will time out and the program will terminate.
For instance http://127.0.0.1:8080/Mysubfolder