Hello Bruce, Stu, any other!
In an older thread from 2016, Stu asked about how to redirect a request from "www" to "root".
When I wanted to hook into that thread with my question, the forum-soft suggested to start a new topic, due to the age of the original thread. So here it goes:
I think I want something very similar like Stu did. I have a .ZIP sitting somewhere in the .\web-directory. This files is meant to be sort of invisible., It should be accessible only, when you are a customer. But we want to avoid to force the user to type a password to verify against his. Folks are not endurable nowadays, all must be made as easy as possibly. I personally like comfort also.
So the idea is, to send out a unique, however not existing URL to each customer, with a specific string or token or whatever it is called, being part of this URL.
Like
https://theserver.com/123ABC/update.ziphttps://theserver.com/qwer99/update.ziphttps://theserver.com/UhT432/update.zipand each url will return the same update.zip. Those inserted tokens will probably based in the customers name, with all spaces removed. Plus a numeric part as a sort of increment for further uses. Have to be unique, though.
Bruce wrote in 2016 in an answer to Stu:
-------------------------------------------------------------
so the call is
p_web.Redirect(toURL)
I think the best place for it is in WebHandler, _SendFile, after loc:filename is set...
something along the lines of
if lower(sub(loc:filename,1,3)) = 'www'
self.redirect....
return
end-------------------------------------------------------------
My question: does this SELF.Redirect() have to have the EXACT address of the file in that toURL-parameter?
First I tried SELF.Redirect('update.zip'), because it sits in the .\web-directory, but it turned into error -34, Error sending data NetSimple.Send. Same with '.\update.zip'. It now works with the exact URL of the ZIP.
Thats okay for me. I just wanted to know, whether I made a mistake on my side or whether this is intended.
I can read a value for this toURL string from an .INI, for pointing to the most recent .ZIP.
[UPDATE]
It seems as if SELF.Redirect('/filename.zip', 1) is working now.
Bonus question: Is it okay to put some data-access into this embed p_web._sendFile() before Parent?
I need to veriy this unique token per customer to verify and also log to a file or send via mail, who already downloaded his / her file.
Or do I misuse the wrong embed here, need to do that somewhere else?
At the moment I ask for Nettalk 10. The upgrade in in the works, but .. yes, it will come - later.
thanks
Wolfgang