jump to article
...intermittent thoughts

HTTP redirects with LotusScript

Have you ever used the $$Return field in a Lotus Notes form? Have you then tried to use a similarity in LotusScript? found one? Hey, you are lucky! For all the other's here's a little how to:

The purpose of a $$Return form is to redirect a HTTP-Request from one location to another. This is really useful if you save a document via Web and want to avoid the very well designed and absolutely self-describing "Form processed" page of a Domino server. There are tons of other things you may need to redirect a page for, using the $$Return field is the way to do this. Usually. But what if you have to or want to use just plain LotusScript to do all the stuff you want to - including a redirect to any kind of a return page? Usually you have two options:
try to pre-calculate the $$Return field by the @Formula engine and then use it. But this is not really a clean way - you always have to code in two different programming languages. Additonally if you are using a WebQuerySave agent on a form which should not be saved (SaveOptions field set to "0") this option does not work.
So, the second option is to print out some small html code like:

< html>< head>< meta http-equiv="refresh" content="5; URL=somewreelse">< /head>< body>< /body>< /html>

yes this works, but it is long, very long and not really the best way to make a redirect. Of course there is the option to do the same by using JavaScript, which is in fact even worse - not every browser uses or wants to use javascript. That's why I dont give an example here.

So how does a real redirect work?

Its so simple I wonder, why I didn't realize it before. If you consider that the first print statement of every LotusNotes agent is written directly to the HTTP protocol header you can easily find the solution. In RFC1945, the spec for HTTP1.0 there is a paragraph describing how a redirect should be done by a server, serving the http protocol. So if you do the same, you can get a redirect too:

simply print the complete URI of your redirect adress as the first output line in your WebQuerySafe agent. Here's an example:

... some piece of code...
print "Location:" & newurl
...some other piece of code...

where newurl contains the complete path or URI of the page to be redirected to.

Yes, that's it! Fast, easy and efficient!
  1. 1) Wizard of Redirect said: (18.03.2005 12:08:40 GMT)
    HTTP redirects with LotusScript

    Doesn't need to be the complete path, any relative or absolute path will work.

  2. 2) Michael Gollmick said: (19.03.2005 12:19:03 GMT)
    HTTP redirects with LotusScript

    you are abolutely right! any path works - complete, relative and a URI...

  3. 3) viagra said: (27.02.2017 14:00:50 GMT)
    buy viagra uk


    { Link } , , { Link } , , , , h{ Link } , ,

  4. 4) buy_viagra said: (10.04.2017 20:37:02 GMT)
    buy viagra

    Of the outside la for its { Link } , , him was too been the biographie from his viagra.

  5. 5) cialis said: (10.04.2017 21:59:38 GMT)
    buy cialis black

    However, the purchasing effect can be a acheter for effective acheter { Link } , a andorre.

  6. 6) cheap_cialis said: (21.04.2017 17:28:08 GMT)
    cheap cialis


    { Link } , ,

  7. 7) online_viagra said: (06.05.2017 14:01:20 GMT)
    online viagra


    { Link } , , { Link } , , { Link } , ,

  8. 8) viagra said: (07.05.2017 1:42:33 GMT)
    cheap viagra professional


    { Link } , , { Link } , , { Link } , ,

  9. 9) generic said: (07.05.2017 7:13:04 GMT)
    order generic viagra


    { Link } , , { Link } , , { Link } , ,

  10. 10) cialis said: (27.05.2017 20:04:32 GMT)
    precio cialis en argentina


    { Link } , ,

  11. 11) Avishek Nag said: (07.10.2018 22:52:51 GMT)
    HTTP redirects with LotusScript

    I am trying out the print statement for redirecting in WQS agent, but still its just a blank white screen. Please suggest.

Add Comment
Web Site:
Comment:  (No HTML - Links will be converted if prefixed http://)
Remember Me?