WebParseResponseRedirect Function

Action

Parses the URL of a redirection response for URL encoded parameters. This modifier is commonly used to get state information generated at server side at run time, like session IDs. When the search parameter is not specified (set to NULL), the complete redirect URL is retrieved.

It is important to know that all parsing and verification functions must be specified before the Web API call for which the response data should be parsed/verified. You can specify multiple parse/verification functions before a Web API call. The order of the parse/verification functions is not relevant (Exception: WebParseDataBound and WebVerifyDataBound using the flag WEB_FLAG_SYNCHRON).

注: The order of multiple calls to WebParseResponseRedirect function affects finding the parameters. The subsequent low-level web function will NOT return until the request has finished. Other requests started before may run in parallel. If only NULL parameter values are specified, no parsing is performed. Instead, the server’s redirection status message will not generate an error message.
注: If you want to parse a Web server response, you must first call the WebParseResponseHeader function. Then you send the request to the Web server.

Include file

WebAPI.bdh

Syntax

WebParseResponseRedirect( out sResult       : string optional,
                          in  nMaxResultLen : number optional,
                          in  sSearchParam  : string optional ): boolean;

Return value

  • true if the parsing modifier could be created successfully

  • false otherwise

Parameter Description
sResult String variable that receives the value of the named parameter or the redirect URL (optional). May be NULL if no return value is needed.
nMaxResultLen Maximum length of the string to return (optional). This value must be less than or equal to the size of the string variable sResult.
sSearchParam Name of the parameter for which to retrieve the associated value (optional). Passing a NULL value causes the complete URL to be stored in sResult.

Example

dcltrans
  transaction TWeb
  var
    sParam1 : string(1000);
    sSession : string(200);
  begin
    WebParseResponseRedirect(sParam1, STRING_COMPLETE, "Param1");
    WebParseResponseRedirect(sSession, STRING_COMPLETE,"SessionID");
    WebUrl("http://localhost/SessionIdTest.asp", 0.0);
    write(sParam1); writeln;
    write(sSession); writeln;
  end TWeb;

Sample scripts

WebRegularExpressions01.bdf