Forum Discussion

winston_dinorog's avatar
11 years ago

[LoadUIWeb] Unique Key Via URL Parameter


I do have 2 ASP.NET web site wherein 


- the first, contains only Login and Logout Pages


- the second, contains the actual Website (actually this is just a subwebsite of the first)


 


The design is that when a user Logs in to Website 1, and has been successfully validated as a valid user, a unique key will be generated and will be then passed to website 2 (only as a URL parameter).  This unique key is ONLY valid for that session.  If the same user logs in, another unique key will be generated and passed to website 2. Only valid Unique keys are accepted in website 2, otherwise, the user will be Forced to LogOut (redirecting again to website 1)


 


My Problem with using the LOadUIWeb is that, im always having an "Invalid Key" since im passing the old key (instead of the newly generated key)


 


Please note that the newly generated key is not stored in a cookie and is only placed as a URL parameter (e.g response.redirect ("http://website2?key=uniquekey")


 


My Question is, how do i set this scenario using LoadWebUI? Appreciate any hints or recommendatations


 


 


Below is the error found on the logs :


Message Time


Request #8 of the virtual user "Virtual user group (1)" has been sent with warnings. The received response code (302) differs from the expected response code (200). 1/9/2014 11:34:43 PM

  • looks like your sample code is ASP.NET, so assuming IIS comes back with both the usual redirection headers and valid HTML in the response body, you can use a Data Extractor (regular expression) to pull the dynamic ID out of the 302 response body as a named variable (ex: "uniqueKey"). something like this example: http://regexr.com?381p8

    then in your subsequent request, wherever the unique key is needed, substitute for the name of the variable with an at-sign in the beginning (ex: "@uniqueKey").