RedirectURL method: Response class
Syntax
RedirectURL(URL)
Description
Use the RedirectURL function to navigate to the location specified by the URL parameter. The given location must be an absolute URL. No further output should be made by the PeopleCode program after calling this method.
Note:
This function does not issue any kind of warning to the user about losing data. Your application should verify that all data is saved before launching a new page.
Note:
If your URL string contains
special characters (such as foreign characters) make sure you encode
it first using the EncodeURL function, such as, %Response.RedirectURL(EncodeUrl(&Url)).
In addition, while you can redirect relative URLs in certain circumstances, you cannot encode them.
Parameters
| Parameter | Description |
|---|---|
|
URL |
Specify the location to navigate to as a string value. |
Example
The following two examples demonstrate how to generate the URL string for component content:
/* Example 1 */
&url = GenerateComponentContentURL(%Portal, %Node, MenuName.GP_WC_FL_MNU, "GBL", Component.GP_WC_PYRL_STG_FL, Page.GP_WC_PAYRL_STG_FL, "U");
%Response.RedirectURL(&url);
/* Example 2 */
&url = GenerateComponentPortalURL(%IntBroker.DefaultPortalName(), %IntBroker.DefaultLocalNode(), MenuName.ROLE_MANAGER, %Market, Component.EP_APPR_MAIN, Page.EP_APPR_MAIN1, "U", &SrcgRecord);
&url = &url | "&SOURCE=MAP";
%Response.RedirectURL(&url);
The following example demonstrates how to generate the URL string to redirect the user to an iScript:
/* Example 3 */
Local string &iScriptName = "IScript_AppHP";
If &renderType = "HTML" Then
&iScriptName = "IScript_AppHtml";
End-If;
&url = GenerateScriptContentURL(%Portal, %Node, Record.WEBLIB_PTPP_SC, Field.HOMEPAGE, "FieldFormula", &iScriptName);
%Response.RedirectURL(EncodeURL(&MyScriptURL));