You might have faced below error during replay of your script, though your script has web_set_user() function. In this article we will see how to fix it using various methods.
Error -26630: HTTP Status-Code=401 (Unauthorized)
Basically above error occurs when the application is trying to validate the simulated request with proper credentials and header information. If any critical parameters missing in the header, LoadRunner throws above error.
Make sure that you have added valid details in the web_set_user() function. It should have valid user identity, password, and the host & port details. It is good to incorporate the password in the encrypted format using lr_decrypt functions. Below is the perfect example of web_set_user function.
web_set_user(“mydomain\\myuserid”, lr_decrypt(“4042e3e7c8bbbcfde0f737f91f”), ” mydomain:8080″);
You can try running the script using WinInet replay instead of Sockets. To change the settings, go to Runtime Settings > Preferences, check Use WinInet replay instead of Sockets (Windows only)
If above two fixes doesn’t work, you need to compare and validate the complete request of LoadRunner and the complete request from Fiddler.
Run the script in LoadRunner by turning on the extended log (preferably with Parameter Substitution and Data returned by server) and capture the request headers, cookies, etc.
Now, open Fiddler and manually navigate the business flow and then compare the request header information with LoadRunner info. If there is a mismatch, you need to incorporate it in the LoadRunner script. E.g. Fiddler request headers had authorization headers, accept encoding etc. You need to use web_add_header function to add the details to the script. If you use any other methods to fix unauthorized error, please let me know in the comments section.
If you like my article, please do share in your favorite social media. Please do not forget to subscribe to my weekly newsletter, it is FREE.