SEND HTTP REDIRECT

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.5


SEND HTTP REDIRECT (url{; *})

ParameterTypeDescription
urlStringNew URL
**If specified = URL is not translated,
If omitted = URL is translated

Description

The SEND HTTP REDIRECT command allows you to transform a URL into another one.

The url parameter contains the new URL that allows you to redirect the request. If this parameter is a url to a file, it must contain the reference to this file, for example: SEND HTTP REDIRECT ("/MyPage.HTM").

When this command is called in contextual mode, the Web process is aborted just after being executed. The command prevails over commands that send data (SEND HTML FILE, SEND HTML BLOB, etc.) that may be in the same method.

This command also allows you to redirect a request to another Web server.

4D automatically encodes the URL's special characters. If you pass the * character, 4D will not translate them.

Example

You can use this command to execute custom requests in 4D by using static pages. Imagine that you have placed the following elements in a static HTML page:

Note: The POST action "/4dcgi/rech" has been associated to the text area and to the OK and Cancel buttons.

In the On Web Connection database method part (or subroutine) that manages the non-contextual mode, you insert the following code:

   Case of
      : ($1="/4dcgi/rech") `When  4D receives this URL
         `If the OK button has been used and the 'name' field contains a Value
         If ((bOK="OK") & (name # ""))
            `Change the URL to execute the request code,
            `placed farther down in the same method 
            SEND HTTP REDIRECT("/4dcgi/rech?"+name)
         Else
            `Else return to the beginning page
            SEND HTTP REDIRECT("/page1.htm")
         End if
         ...
      : ($1="/4dcgi/rech?@") `If the URL has been redirected
         ... `Put the request code here
   End case


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next