Hi All,
First of all, here is what the performance rig is like
1) Two webservers in clustered environment on a subnet.
2) One ADFS server in the same subnet as the webservers for authentication.
3) One DB server on the same subnet.
When user navigates to the http://webserver/ they are redirected to the http://ADFS/ machine which would display the user a page where he/she would choose their federation server, once they choose their federation server this page would place a cookie and would not be displayed next time user is redirected for authentication.
After choosing the fedration server user is presented with a login page which is hosted on the ADFS box, user would put their CORRECT user name and password and this login page would authenticate and redirect them back to http://webserver/homepage/
Now, as I record all these steps every thing is recorded fine and I get four requests. But when I play back this script I am getting redirected to custom error page instead of users Homepage.
Here is what coded test looks like, any suggestion to get pass this initial step would be appreciated.
Option Strict Off
Option Explicit On
Imports Microsoft.VisualStudio.TestTools.WebTesting
Imports Microsoft.VisualStudio.TestTools.WebTesting.Rules
Imports System
Imports System.Collections.Generic
Imports System.Text
Namespace UHN
Public Class WebTest1Coded
Inherits ThreadedWebTest
Public Sub New()
MyBase.New()
Me.PreAuthenticate = True
End Sub
Public Overrides Sub Run()
Dim request1 As WebTestRequest = New WebTestRequest("https://cciswebnlb.ccisqadeploy.local/portal/")
request1.ThinkTime = 5
Dim rule1 As ExtractHiddenFields = New ExtractHiddenFields
rule1.ContextParameterName = "1"
AddHandler request1.ExtractValues, AddressOf rule1.Extract
MyBase.Send(request1)
Dim request2 As WebTestRequest = New WebTestRequest("https://ccisqaadfs01.ccisqadeploy.local/adfs/ls/discoverclientrealm.aspx")
request2.ThinkTime = 10
request2.Method = "POST"
request2.QueryStringParameters.Add("wa", "wsignin1.0", False, False)
request2.QueryStringParameters.Add("wreply", "https%3a%2f%2fcciswebnlb.ccisqadeploy.local%2fportal%2f", False, False)
Dim request2Body As FormPostHttpBody = New FormPostHttpBody
request2Body.FormPostParameters.Add("__VIEWSTATE", Me.Context("$HIDDEN1.__VIEWSTATE").ToString)
request2Body.FormPostParameters.Add("ddlRealm", "urn:federation:self")
request2Body.FormPostParameters.Add("btnSubmit", "Submit")
request2Body.FormPostParameters.Add("__EVENTVALIDATION", Me.Context("$HIDDEN1.__EVENTVALIDATION").ToString)
request2.Body = request2Body
Dim rule2 As ExtractHiddenFields = New ExtractHiddenFields
rule2.ContextParameterName = "1"
AddHandler request2.ExtractValues, AddressOf rule2.Extract
MyBase.Send(request2)
End Sub
End Class
End Namespace
Regards,
Khawaja.

[Urgent Help needed] VSTS unable to log into ADFS!
Anton Papst
FHJJr
Requests are not different at all but the response is diff for the same request.
This authentication is done through webservice, any suggestions on how to go about doing that I am looking into http://msdn2.microsoft.com/en-us/library/ms182557(VS.80).aspx as well, but if you have any suggestion on what requests should be considered webservice requests and any example would help as well.
Juvraj
tiffeyneohelp
OK did that.
Here is the point where script fails and the problem is with the responce, it is missing the SET-COOKIE information. This is what the responce looks like when the fiddler script works (for about 30 mins with hard coded cookie values but __VIEWSTATE and __EVENTVALIDATION is pulled out from Extract hidden field as you suggested)
HTTP/1.1 302 Found
Connection : keep-alive
Date : Fri, 15 Dec 2006 18:25:09 GMT
Location : https://cciswebnlb.ccisqadeploy.local/portal/ADFSLogin.aspx
Set-Cookie : _WebSsoAuth=eNqdVlmTskgW/SsV9iNRxaLServer : Microsoft-IIS/6.0
X-AspNet-Version : 2.0.50727
X-Powered-By : ASP.NET
Cache-Control : private
Content-Type : text/html; charset=utf-8
Content-Length : 176
Here is what the responce looks like (even though the request made was pretty similar in both cases) on the same request after the scripts does not run correctly any more (same fiddler script after 30 min with hard coded cookie values but __VIEWSTATE and __EVENTVALIDATION is pulled out from Extract hidden field)
HTTP/1.1 200 OK
Connection : close
Cache-Control : private
Content-Type : text/html; charset=utf-8
Date : Fri, 15 Dec 2006 18:41:32 GMT
Server : Microsoft-IIS/6.0
X-AspNet-Version : 2.0.50727
X-Powered-By : ASP.NET
Now how can I make the set cookie re-appear in the above response. so it pulls out the cookie information from the earlier response and places it in the request thats does not send the cookie information.
dseifert
DeNiS-21
You are going to have to add in the extraction rules for the hidden fields such as viewstate. For example
....
WebTestRequest request2 = new WebTestRequest("https://ccisqaadfs01.ccisqadeploy.local/adfs/ls/");
request2.FollowRedirects = false;
request2.Version = "1.0";
request2.QueryStringParameters.Add("wa", "wsignin1.0");
request2.QueryStringParameters.Add("wreply", "https://cciswebnlb.ccisqadeploy.local/portal/");
request2.QueryStringParameters.Add("wct", "2006-12-13T21:58:41Z");
request2.QueryStringParameters.Add("wctx", https://cciswebnlb.ccisqadeploy.local/portal/ADFSLogin.aspx);
ExtractHiddenFields
rule1 = new ExtractHiddenFields();rule1.ContextParameterName =
"1";request2.ExtractValues +=
new EventHandler<ExtractionEventArgs>(rule1.Extract); yield return request2; WebTestRequest request3 = new WebTestRequest("https://ccisqaadfs01.ccisqadeploy.local/adfs/ls/discoverclientrealm.aspx");request3.FollowRedirects =
false;request3.Method =
"POST";request3.Version =
"1.0";request3.QueryStringParameters.Add(
"wa", "wsignin1.0");request3.QueryStringParameters.Add(
"wreply", "https://cciswebnlb.ccisqadeploy.local/portal/");request3.QueryStringParameters.Add(
"wct", "2006-12-13T21:58:41Z");request3.QueryStringParameters.Add(
"wctx", "https://cciswebnlb.ccisqadeploy.local/portal/ADFSLogin.aspx"); FormPostHttpBody request3Body = new FormPostHttpBody();request3Body.FormPostParameters.Add(
"__VIEWSTATE", this.Context["$HIDDEN1.__VIEWSTATE"].ToString());request3Body.FormPostParameters.Add(
"ddlRealm", "urn:federation:self");request3Body.FormPostParameters.Add(
"btnSubmit", "Submit");request3Body.FormPostParameters.Add(
"__EVENTVALIDATION", this.Context["$HIDDEN1.__EVENTVALIDATION"].ToString());request3.Body = request3Body; yield return request3;....
Sachitha
Beth31
yamobe
The script posted above is VSTS script, the one pasted below is the Fiddler-2 script for the same steps.
Steps:
1) Navigate to URL
2) Choose your federation server and click Submit
3) Input user name and password then press login button
Fiddler script imported into VSTS and then generated code for it.
public class Clean_FiddlerCoded : WebTest
{
public Clean_FiddlerCoded(){
this.PreAuthenticate = true;}
public override IEnumerator<WebTestRequest> GetRequestEnumerator(){
WebTestRequest request3 = new WebTestRequest("https://ccisqaadfs01.ccisqadeploy.local/adfs/ls/discoverclientrealm.aspx");request3.FollowRedirects =
false;request3.Method =
"POST";request3.Version =
"1.0";request3.QueryStringParameters.Add(
"wa", "wsignin1.0");request3.QueryStringParameters.Add(
"wreply", "https://cciswebnlb.ccisqadeploy.local/portal/");request3.QueryStringParameters.Add(
"wct", "2006-12-13T21:58:41Z");request3.QueryStringParameters.Add(
"wctx", "https://cciswebnlb.ccisqadeploy.local/portal/ADFSLogin.aspx"); FormPostHttpBody request3Body = new FormPostHttpBody();request3Body.FormPostParameters.Add(
"__VIEWSTATE", @"/DAmdnZGRkLt9t4s7Y0d6apFG3FOo4B/4JEX0=");request3Body.FormPostParameters.Add(
"ddlRealm", "urn:federation:self");request3Body.FormPostParameters.Add(
"btnSubmit", "Submit");request3Body.FormPostParameters.Add(
"__EVENTVALIDATION", "/lklksndflkslkfdlksfdwoiujweoiruoew");request3.Body = request3Body;
yield return request3;hipswich
This is the request for successful login
POST /portal/ HTTP/1.0
User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept : */*
Accept-Language : en-US
Content-Type : application/x-www-form-urlencoded
Host : cciswebnlb.ccisqadeploy.local
Content-Length : 4405
Accept-Encoding : gzip
Connection : Keep-Alive
BODY
This is the request for UN-successful login
POST /portal/ HTTP/1.0
User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept : */*
Accept-Language : en-US
Content-Type : application/x-www-form-urlencoded
Host : cciswebnlb.ccisqadeploy.local
Content-Length : 4405
Accept-Encoding : gzip
Connection : Keep-Alive
XNA Rockstar
It was adding to the confusion
GoDaddy
Ok did that, now one last push and script will be on its way, what to do with
error page being displayed right after request7 in the code below
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestProject2 {
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.WebTesting;
using Microsoft.VisualStudio.TestTools.WebTesting.Rules;
public class MoreCleanFiddlerCoded : WebTest {
public MoreCleanFiddlerCoded() {
this.PreAuthenticate = true;
}
WebTestRequest request7 = new WebTestRequest("https://cciswebnlb.ccisqadeploy.local/portal/");
request7.FollowRedirects = false;
request7.Method = "POST";
request7.Version = "1.0";
FormPostHttpBody request7Body = new FormPostHttpBody();
request7Body.FormPostParameters.Add("wa", "wsignin1.0");
request7Body.FormPostParameters.Add("wresult", this.Context["$HIDDEN1.wresult"].ToString());
request7Body.FormPostParameters.Add("wctx", "https://cciswebnlb.ccisqadeploy.local/portal/ADFSLogin.aspx");
request7.Body = request7Body;
yield return request7;
}
}
}
Same thing (Extract Hidden fields) as with the __VIEWSTATE does not work for this puppy. I am being redirected to the error page! Some thing is not right with $HIDDEN1.wresult
its not pulling the cookie information
Singersinger
Yes that is true,
I have recorded the same steps with Fiddler-2 (because all traffic on the performance rig is HTTPS) and after importing that script as .webtest I was able to log in the system for 1-2 runs (Fiddler scripts have hard coded values) and as soon the __VIEWSTATE changed those scripts stopped working as well. The script would still run just fine but it would start redirecting to the error page instead of the user home page.
I tried updating the Fiddler-2 script by putting Extraction rules on hidden values before the request that have __VIEWSTATE and __EVENTVALIDATION in them but it seems like when I run that script it still remembers the hard coded values and does not update these dynamic values every time it runs.
And thanks alot for helping!