Highlighted
Absent Member.
Absent Member.
136 views

Authentication filed due to redirection of host url

While recording, Request sent to the server1 is redirected to server2.
Application had prompted the user for authentication verification,before redirecting to the server 2. Upon giving the correct credentials, reached the home page.

However when replayed the recorded script, system gives an error message as invalid authentication. More over LR is sending the server2 address as a request. When analysed it in the generation log,

web_reg_set is used and parameterised ("{DomainName}\\{UserName}","{Password}","proxy.corp.aal.au:10003");

Kindly advice , how to handle this issue. Thanks in advance
0 Likes
1 Reply
Highlighted
Super Contributor.
Super Contributor.

Re: Authentication filed due to redirection of host url

How to capture the URL that is formed because of redirection?

Example:
When visiting http://www.mercury.com, user will be redirected to a different location. How to capture the redirected URL.


   
Solution
 Use web_reg_save_param()

When that the server redirects a HTTP request to another URL, it normally does that by sending a HTTP 302 Moved header. To verify
1. Run the script in extended log with "data retuned by server' turned on
2. Check the execution log for "302 moved'

You can also see that along with this header, the server also sends the following header information:
   "Location: <URL>."

The URL specified in the "Location' header will be the URL that the original HTTP request be redirected to. To capture this URL, you have to capture the string between "Location:" and "\r\n" (end of line).

Example:

      Action()
      {

         //use the correlation statement to capture the redirection
         web_reg_save_param ("Redirection", "LB=Location: ","RB=\r\n" ,LAST );

         //Visit Mercury homepage
         web_url("Mercury","URL=http://www.mercury.com/", LAST);

         //Print the redirected URL
         lr_message("redirected address = %s", lr_eval_string("{Redirection}"));

         return 0;
      }

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.